Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Table
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Centering tables === {{shortcut|HELP:TABLECENTER}} To center a table horizontally, use style {{kbd|margin: auto}}, which applies to the left and right margins. Text does not flow around centered tables as it does for floated tables; that is, no text appears to either side: <div class="box"> '''Wikitext''' <syntaxhighlight lang=wikitext highlight=2> Text before table... {| class="wikitable" style="margin: auto; border: none;" |+ Centered table |- ! scope="col" | Duis ! scope="col" | aute ! scope="col" | irure |- | dolor || in reprehenderit || in voluptate velit |- | esse cillum dolore || eu fugiat nulla || pariatur. |} ...text after table </syntaxhighlight> </div> '''As it appears in a browser:''' Text before table... {| class="wikitable" style="margin: auto; border: none;" |+ Centered table |- ! scope="col" | Duis ! scope="col" | aute ! scope="col" | irure |- | dolor || in reprehenderit || in voluptate velit |- | esse cillum dolore || eu fugiat nulla || pariatur. |} ...text after table. Style {{kbd|margin:auto}} may be combined with top and bottom margin in the standard way for CSS, e.g. <syntaxhighlight lang=wikitext inline>style="margin:1em auto"</syntaxhighlight> defines top and bottom margins of 1em, and automatic (centered) left and right margins. '''Tip:''' For Android Chrome, use: :<code><nowiki>{| style="margin: auto; border: none;"</nowiki></code>{{efn|group=note|''border: none;'' to avoid an empty column in tables narrower than the browser window in Android Chrome.}} '''Note:''' <code>align="center"</code> is [[Wikipedia:HTML 5|deprecated in HTML5]], and does not work well in Mediawiki software. For example; it will not override the left alignment of tables via <code>class=wikitable</code>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)