Setup & site building · Guide
How to Center a Button in WordPress (Step by Step)

Short answer
In the block editor, click your button, then select its parent Buttons block from the toolbar or List View. Open the justification control and choose center, then update the page. In Elementor or Divi, use the button's alignment setting, and for theme buttons use a small CSS rule.
Key takeaways
- Alignment lives on the parent Buttons block.
- Use List View to select the right block.
- Page builders have an alignment setting per device.
- In the Classic Editor, wrap the link in a centered div.
- CSS can center any button with margin auto or flexbox.
How do you center a button in WordPress?
In the block editor, select the Buttons block that wraps your button, click the justification control in the toolbar and choose center, then save the page.
Centering a button sounds simple, but beginners often get stuck because they select the wrong block. In WordPress, each Button sits inside a parent Buttons block, and alignment lives on the parent.
The steps also differ if you use the Classic Editor, Elementor, Divi or a theme with its own button styles.
This guide covers each case, plus a CSS fix for stubborn buttons. If you have not added a button yet, start with our guide on creating a button in WordPress.
When should a button be centered?
Center a button when it sits under centered text, such as a hero section or a call to action box, and keep it left aligned when it follows left-aligned paragraphs.
Alignment is about matching what is around the button. A centered button under a left-aligned paragraph looks like it is floating in the wrong place.
Centered buttons work well at the end of a short, centered section. Think of a headline, one line of text and a single action, all stacked in the middle of the page.
In long articles, readers scan down the left edge. A left-aligned button sits where their eyes already are, so it is often easier to notice.
On phones the difference is smaller, because the content column is narrow. Many sites center buttons on mobile and left align them on desktop. Page builders let you do this with per-device settings.
Whatever you choose, be consistent. If every call to action on your site is centered, readers learn where to look.
Which method fits your editor?
Use the Buttons block's justification in the block editor, the alignment setting in page builders, and a small HTML or CSS wrapper in the Classic Editor or theme code.
| Where the button is | How to center it |
|---|---|
| Block editor (Gutenberg) | Select the parent Buttons block, then justify center |
| Classic Editor | Wrap the button link in a centered paragraph or div |
| Elementor | Button widget, Content tab, Alignment set to center |
| Divi | Button module, Design tab, alignment setting |
| Theme or plugin button | Plugin setting, or custom CSS |
Step 1: How do you center a button in the block editor?
Click the button, select its parent Buttons block using the toolbar's parent selector or List View, open the justification dropdown and choose Justify items center.
- Open the page or post in the editor.
- Click the button you want to center.
- In the toolbar, click the parent block icon to select the Buttons block, or open List View and click Buttons.
- Click the justification control in the toolbar.
- Choose the center option.
- Click Save or Update.
The WordPress Buttons block documentation explains the parent and child structure in more detail.
If the toolbar shows no justification icon, you have the single Button selected rather than the Buttons group. Go up one level and try again.
You can also set a button to full width from the single Button block's settings. A full-width button fills its container, so it looks centered by default. This is popular on mobile layouts and inside narrow cards, where a wide tap target is easier to hit.
If your page uses a Group or Columns block around the button, check the alignment of that container too. A group set to a narrow width and pushed to the left will carry your centered button with it.
Step 2: How do you center several buttons in a row?
Keep all the buttons inside one Buttons block and set its justification to center, so the whole group sits in the middle with even spacing.
When you press Enter after a button, WordPress adds another button in the same group. All of them share the parent's alignment.
You can also switch the group to a vertical layout in the block settings. Vertical buttons can be centered the same way.
If one button needs different alignment, place it in its own Buttons block. Each group has its own justification.
Step 3: How do you center a button in the Classic Editor?
Switch to the Text tab and wrap the button link in a paragraph or div with centered text, or use the editor's align center button on the line holding it.
In the Classic Editor, buttons are usually links with a CSS class added by your theme or a shortcode. Putting the link on its own line and clicking the align center icon often works.
If it does not, open the Text tab and wrap the link like this:
<div style="text-align:center;">
<a class="button" href="https://example.com">Get started</a>
</div>
This works because inline elements such as links follow the text alignment of their container.
Some themes give you button shortcodes instead, such as a shortcode with an align option. Check your theme's documentation, because a built-in option is easier to maintain than hand-written HTML. Inline styles also make later design changes harder, since you have to find and edit each button one by one.
If you are still on the Classic Editor and want to try blocks, see our guide on enabling the Gutenberg editor.
Step 4: How do you center a button in Elementor?
Click the Button widget, stay on the Content tab, find the Alignment control and choose the center icon, then repeat for tablet and mobile if needed.
Elementor's alignment setting can be different for each device. Click the device icon next to Alignment to check tablet and phone views.
If the button still looks off center, check the column. A column with extra padding on one side will shift everything inside it.
The Elementor help center documents every widget setting. Our guide to using Elementor covers the editor basics.
How do you center a button in Divi?
Open the Button module settings, go to the Design tab, find the alignment option for the button, choose center, and save.
Divi keeps alignment with the other design settings rather than the content. It can also be set per device.
Elegant Themes explains the module in its Button module documentation. If you are new to Divi, our guide on using Divi Builder covers the layout basics.
How do you center a button with CSS?
Give the button's wrapper a centered layout, either with text-align center on the parent, margin auto on a block-level button, or flexbox with justify-content center.
Sometimes a theme or plugin adds buttons that have no alignment setting. CSS fixes that.
Add one of these in Appearance, then Customize, then Additional CSS, replacing the class name with your button's class:
.my-button-wrap { text-align: center; }
.my-button { display: block; width: fit-content; margin: 0 auto; }
.my-button-wrap { display: flex; justify-content: center; }
Use only one of the three. MDN's guide to justify-content explains how the flexbox option works.
The first rule centers anything inline inside the wrapper. The second centers the button itself by giving it equal automatic margins on both sides. The third uses flexbox and is the most flexible when you have several buttons in a row.
To find the class, right-click the button on your site and choose Inspect. Block themes can also add CSS in the Site Editor's Styles panel.
Why won't my button center?
Usually the wrong block is selected, the container is narrower than you think, a theme style overrides yours, or a cache shows the old page.
- Wrong block selected. Alignment is on the parent Buttons block, not the single Button.
- Narrow container. The button is centered inside a column or group that is itself off to one side.
- Theme CSS. A theme rule like float: left can override centering. Inspect the button to find it.
- Cache. Clear your caching plugin and browser cache, then reload.
Our guide on clearing the WordPress cache explains each cache layer.
What else can you change about a button?
Once your button is centered, you can change its color, size, text, link and border radius from the same block or widget settings.
Our guide on editing a button in WordPress covers text, links and styles.
If the color clashes with your design, see our guide on changing button color. The block editor handbook is a good reference if you want to set default button styles for your whole theme.
Frequently asked questions
Why is there no center option for my button?
You probably selected the single Button block rather than its parent Buttons block. The justification control only appears on the parent. Click the parent selector icon in the toolbar or pick Buttons in List View, and the center option will appear.
How do I center a button on mobile only?
Page builders such as Elementor and Divi let you set alignment per device, so choose center for the phone view. In the block editor, use a CSS rule inside a media query that targets small screens and centers the button's wrapper.
Can I center a button without CSS?
Yes, in most cases. The block editor's Buttons block, Elementor and Divi all have built-in alignment settings. CSS is only needed for buttons added by themes or plugins that do not offer an alignment option.
Why does my centered button look off center?
The button is probably centered inside a container that is not centered itself, such as a column with uneven padding or a group with a set width. Check the parent column or group settings, or inspect the page to see the container's size.
How do I center a button in a block theme?
The same way as any block content. Select the parent Buttons block and choose center justification. If the button is in a template, such as the header, open it in the Site Editor, make the change there and save the template.
Sources
- Buttons Block WordPress.org Documentation
- Block Editor Handbook WordPress Developer Resources
- justify-content MDN Web Docs
- Divi Button Module Elegant Themes
- Elementor Help Center Elementor
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


