07Days
00HRS
00MINS
00SECS

WP30

,

How to Center a Table in WordPress (Step by Step)

How to center a table in WordPress with a centered pricing table and the Alignment setting

A table that hugs the left edge of the page while the right side sits empty looks unfinished. Centering it is a small change, but it makes pricing plans, schedules and comparison tables look balanced and easier to read.

In this guide you will learn how to center a table in WordPress in two ways: with the core WordPress Table block (plus a short CSS snippet for any table), and with the WP Table Builder plugin, which gives you an Alignment setting and a Max Width option in the builder. You will also learn how to center the content inside table cells and what to check when a table refuses to move.

What Does It Mean to Center a Table?

Centering a table means placing the whole table in the middle of the content area, with equal empty space on the left and right. This only works when the table is narrower than the space around it. A table that already fills 100% of the content width has nothing to move, so it looks the same whichever alignment you pick.

Center a table in WordPress: a left aligned table next to a centered table with equal space on both sides
A left aligned table leaves an empty gap on one side. A centered table keeps equal space on both sides.

It helps to keep two ideas apart:

  • Centering the table moves the whole table block to the middle of the page.
  • Centering the content lines up the text, images or buttons inside each cell.

Most good looking tables use both: a centered table with a sensible maximum width, and cell content aligned in a way that suits the data. For example, names and labels usually read best on the left, while short values such as prices, ratings or check marks look cleaner in the middle.

Option 1: Center a Table with the WordPress Table Block

The core Table block has built in alignment options, so you can center a simple table without any plugin.

  1. Open the post or page in the block editor and add a Table block (or click an existing one).
  2. Enter your rows and columns. Keep the columns short so the table does not stretch to full width.
  3. Click the Align button in the block toolbar and choose Align center.
  4. To center the text in a column, click a cell in that column, open Align column in the toolbar and choose Align column center.
  5. Click Preview to check the result, then update or publish the page.

When you choose Align center, WordPress lets the table shrink to fit its content and places it in the middle. If your table still looks full width, it is probably wide enough to fill the content area already. Try shorter column headings, or turn off Fixed width table cells in the block settings so the columns size themselves to their content.

Center Any Table with a Few Lines of CSS

If your table comes from the Classic editor, a shortcode or another plugin, you can center it with CSS. Give the table a width smaller than 100% and set the left and right margins to auto. Add the code in Appearance > Customize > Additional CSS, or in Appearance > Editor > Styles > Additional CSS on block themes.

.centered-table table {
  width: auto;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.centered-table td,
.centered-table th {
  text-align: center;
}

Then add centered-table in the Additional CSS class(es) field under the block’s Advanced panel. The first rule centers the table itself. The second rule centers the text in every cell, so leave it out if you only want the table centered.

The core block works well for small, plain tables. It has no visual design tools, though, so for styled tables with headers, colors, images, buttons or mobile layouts, a table plugin saves time. Here is how to do it with WP Table Builder.

Option 2: Center a Table with WP Table Builder

WP Table Builder is a drag and drop table builder for WordPress. Table alignment, max width and cell alignment are all settings in the builder, so you never need to write CSS.

Step 1: Create or Open Your Table

Go to WP Table Builder > Add New to start a new table from a blank grid or a template, or open an existing table from All Tables. Add your content with the Text, Image, Button and other elements from the left panel.

The WP Table Builder builder with the top bar, the Elements panel on the left and a comparison table on the canvas
The WP Table Builder builder with the Elements panel on the left and the table on the canvas.

Step 2: Set the Table Alignment to Center

Open the table Settings and expand the General section. Next to Alignment, pick the center icon. You can also choose left or right if your layout needs it. New tables already use center alignment by default, so this step is mostly for tables that were set to left or right earlier.

WP Table Builder General settings with Use th for first row turned on
The General section of the table settings, where you find Alignment, Table Container Max Width and Cell Min Auto Width.

Step 3: Turn On Table Container Max Width

Alignment only has a visible effect when the table is narrower than the page. In the same General section, turn on Table Container Max Width and enter a value such as 700 or 760 px. The table now stops growing at that width and sits in the middle of wider content areas. Pick a width that suits your columns: three or four short columns look good around 700 px, while wide comparison tables need more room.

Step 4: Set Cell Min Auto Width

Cell Min Auto Width, also in the General section, sets the smallest width a column can shrink to. Raise it if your columns look squeezed after you set a max width, or lower it if the table refuses to fit. You can also add Table Padding here to leave some breathing room around the table.

Step 5: Align the Content Inside the Cells

Now line up the content inside the table:

  • Text: click a Text element and use the alignment buttons in its toolbar to align it left, center or right.
  • Images: select an Image element and use Image Alignment in its settings.
  • Buttons: select a Button element and use Button Alignment.
  • Vertical position: select a cell, row or column and set the vertical alignment to top, middle or bottom, so short content lines up with taller cells next to it.
WP Table Builder Content Alignment section with Vertical Alignment and Content Distribution buttons
Vertical alignment and content distribution options for table cells in WP Table Builder.

Step 6: Check the Table on Tablet and Mobile

Open the Responsive tab and preview the table on tablet and mobile. On small screens the table fills the screen width, so centering matters less than a clean layout. Turn on Enable Responsive Table to stack rows into cards, or use horizontal scrolling for wide tables. Our guide on how to create responsive tables in WordPress explains each option.

WP Table Builder Responsive tab with the Mobile breakpoint selected, showing Stack Direction, First Row As Header and a stacked table preview
The Responsive tab in WP Table Builder with the Mobile breakpoint and a stacked table preview.

Step 7: Save and Embed the Table

Click Save, then add the table to a post or page with the WP Table Builder block, or copy the shortcode from the Embed dialog and paste it anywhere shortcodes work.

WP Table Builder Embed this table dialog showing the wptb id shortcode, the Copy button, and Gutenberg, Elementor and Divi options
The Embed this table dialog with the WP Table Builder shortcode.

Live Example: A Centered Table

The table below is a real WP Table Builder table. Its Alignment is set to Center and its Table Container Max Width is 760 px, so on a wide screen it sits in the middle of the content area. It also doubles as a quick reference of the settings from this guide.

Setting

Where to find it

What it does

1Alignment

General settings

Left, Center or Right

2Max Width

General settings

Caps how wide the table gets

3Cell Min Auto Width

General settings

Stops columns from squeezing

4Table Padding

General settings

Adds space around the table

5Text Alignment

Text element

Centers text inside a cell

6Vertical Alignment

Cell controls

Top, middle or bottom

Powered by WP Table Builder

Why Is My Table Not Centering?

If you picked center alignment and nothing changed, check these common causes:

  • The table is already full width. A table at 100% width has no free space to center in. Set a max width or make the columns narrower.
  • The parent block is aligned left. If the table sits inside a Group, Columns or page builder section, that container may be narrow or aligned left. Check its alignment and width settings too.
  • Theme CSS overrides it. Some themes force tables to full width. A max width setting or the CSS snippet above usually fixes this.
  • You are looking at an old cached page. Clear your caching plugin and browser cache, then check again.
  • You centered the text, not the table. Text alignment only moves content inside cells. Use the table Alignment setting or the block Align button to move the whole table.

Tips for Good Looking Centered Tables

  • Pick a max width that fits your content, not the widest number possible. A narrow table with short columns is easier to scan.
  • Keep labels and long text left aligned, and center short values such as prices, ratings, icons and buttons.
  • Use a colored header row and alternating row colors so the eye can follow each row. The guide on table design mistakes has more ideas.
  • Use merged cells for section titles that span the full width of the table.
  • Add images or videos only where they help, as shown in how to add images and videos to a WordPress table.

Frequently Asked Questions

How do I center a table in WordPress without a plugin?

Select the Table block, click the Align button in the block toolbar and choose Align center. For tables from other sources, add CSS that sets a width below 100% and margin-left and margin-right to auto.

Why does my centered table still look full width?

How do I center text inside table cells?

Is table alignment a free feature in WP Table Builder?

Can I center a table vertically on the page?

Conclusion

Centering a table in WordPress takes only a minute. For simple tables, the core Table block’s Align center option or a short CSS rule does the job. For styled tables, WP Table Builder lets you set Alignment to Center, cap the width with Table Container Max Width and line up the content in every cell, all without code. If you are new to table plugins, read why use a table plugin in WordPress to see what else you can do.

Comments

Leave a Reply