Webflow sync, pageviews & more.
NEW

How can I center button text both horizontally and vertically in Webflow without using flexbox?

TL;DR
  • Set text alignment to center and match the line-height to the button height for vertical centering.
  • Remove vertical padding and use horizontal padding for spacing; set display to inline-block or block for proper control.

To center button text both horizontally and vertically without using flexbox in Webflow, you can use a combination of text alignment, line-height, and padding.

1. Set Text Alignment to Center

  • Select your button in Webflow Designer.
  • In the Style panel, set Text Align to center under the Typography section.
  • This ensures horizontal centering of the text inside the button.

2. Match Line Height to Button Height

  • Set the Line Height of the text to be equal to the height of the button.
  • For example, if your button height is 40px, set the line height to 40px as well.
  • This vertically centers the text by using the height of the line box.

3. Remove Vertical Padding (Optional)

  • If you're using line-height for vertical centering, then:
  • Remove or reduce vertical padding (top and bottom) to 0 or small values.
  • Keep in mind that extra padding will shift the perceived center.

4. Horizontal Padding for Width

  • Add left and right padding to control the button’s width and spacing around the text.
  • For example, use 20px left and right padding to create space on both sides.

5. Set Display to Inline-Block or Block

  • Ensure the button is set to Display: inline-block or block (not inline).
  • This allows you to control width, height, line-height, and padding accurately.

Summary

To center button text without flexbox in Webflow, use centered text alignment and match line-height to button height while removing vertical padding. This method reliably centers the text both horizontally and vertically.

Rate this answer

Other Webflow Questions