Button Position and Size Demo

Button Sizes

Absolute Positioning

Flexbox Centering

Flexbox Distribution

Flexbox Space Around

CSS Code Examples

To set specific button sizes:

/* Size using width and height */
.button {
  width: 150px;
  height: 40px;
  font-size: 16px;
}

/* Size using padding */
.button {
  padding: 12px 24px;
  font-size: 16px;
}

To position a button:

/* Center a button absolutely */
.center-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Position in corners */
.top-right {
  position: absolute;
  top: 20px;
  right: 20px;
}

/* Using flexbox to center */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}