Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Bootstrap does not provide a dedicated square-button class. To make one, use a normal Bootstrap button class and add CSS that sets its width and height to the same value. Add responsive dimensions if the button must resize with the viewport, and preserve a clear accessible name and keyboard focus state.

Does Bootstrap have a square button class?

No dedicated square-button modifier appears in the Bootstrap v5.3 Buttons documentation. The documentation identifies its current v5.3 line as v5.3.8. Bootstrap provides the button foundation—such as variants, outline styles, size modifiers, disabled states, and toggle behavior—while square dimensions are a layout decision you define in CSS.

The base .btn class supplies basic padding and content alignment. On its own, it has a transparent background and border and no explicit focus or hover styling, so define the styles your design needs. Bootstrap specifically advises adding explicit :focus or :focus-visible styling when using .btn by itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I make a square button in Bootstrap?

Apply a Bootstrap variant and a reusable project-specific class to a semantic button. Set equal width and height, then use flexbox to center the contents.

<button type="button" class="btn btn-primary btn-square">Save</button>
.btn-square {
  width: 6rem;
  height: 6rem;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

The six-rem dimensions are an illustrative starting point, not a Bootstrap default or a tested recommendation. Choose dimensions that fit the label or icon and the surrounding interface. Adjust padding, font size, and line height as needed; longer text may wrap or feel cramped in a small square.

Choose a Bootstrap variant such as btn-primary, btn-secondary, or an outline style to communicate the button’s visual hierarchy. Do not rely on color alone to explain what an action does.

How can I make a responsive square button?

At each breakpoint where the button changes size, set its width and height to matching values. This keeps the shape square while adapting it to available space.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.btn-square {
  width: 4rem;
  height: 4rem;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .btn-square {
    width: 6rem;
    height: 6rem;
  }
}

These breakpoint and dimension values are examples, not prescribed settings. Check the smallest size for legibility and ensure the control fits its container at every viewport. A third-party MDBootstrap square-button example demonstrates fixed and breakpoint-specific dimensions, including a 100-by-100-pixel sample with zero padding; treat those as examples rather than universal sizing guidance.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Should a square button use text or an icon?

Text labels

A short visible label such as “Save” makes the action understandable without depending on color or an icon’s interpretation. Keep the button large enough that the text remains readable and does not wrap awkwardly.

Icon-only buttons

An icon-only button needs an accessible name that describes its action, such as an appropriate aria-label. Bootstrap Icons can provide a square glyph as an SVG or icon-font character, but an icon is visual content, not a physical button or a replacement for accessible labeling. See the Bootstrap Icons square glyph reference.

Which element should I use, and what should I check?

  • Use a <button> for an action performed on the current page.
  • For navigation, use a link styled with Bootstrap button classes. If an anchor triggers in-page functionality instead of navigating, Bootstrap’s guide says it should carry role="button".
  • Provide a visible keyboard focus indicator; do not remove the browser’s focus outline without a clear replacement.
  • Give icon-only controls an accessible name and make the action clear without color alone.
  • Test label wrapping, alignment, and legibility at the smallest responsive dimensions.
  • Check the license of any third-party component or copied code. Bootstrap identifies its code as MIT licensed and its documentation as CC BY 3.0 on its v5.3 documentation reference; that does not establish the license for other providers’ code.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.