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!
=== Nested tables === {{hatnote|Note: because they cause [[Wikipedia:Manual of Style/Accessibility/Data tables tutorial#Avoiding nested data tables|accessibility issues]], header cells in nested tables should be avoided whenever possible. For accessibility, any complicated table must be carefully designed to maintain normal flow, i.e. the ordering of content in the page code should match the order in which it is to be presented.}} Nesting data tables with header cells makes it difficult for assistive [[screen readers]] to parse them sensibly. Editors sometimes use headerless tables as an aid to content layout, especially where it is easier than the equivalent use of divs and CSS styling. For complex layouts, <code>rowspan</code> and <code>colspan</code> may be used, but again it is sometimes simpler and more maintainable to use nested tables. {{em|Nested tables must start on a new line.}} In the following example, five different tables are shown nested inside the cells of a sixth, main table. None has any header cells. Automatically, the two tables |A| and |B|B| are vertically aligned instead of the usual side-by-side of text characters in a cell. <code>float</code> is used to fix each of tables |C| and |D| to their own position within one cell of the table. This may be used for charts and schematics. <div class="box" style="background-color: white;"> {| style="border: 1px solid black;" | style="border: 1px solid black;" | α | style="border: 1px solid black; text-align:center;" | cell2 {| style="border: 2px solid black; background: #ffffcc;" <!-- The nested table must be on a new line --> | style="border: 2px solid darkgray;" | NESTED |- | style="border: 2px solid darkgray;" | TABLE |} | style="border: 1px solid black; vertical-align: bottom;" | the original table again | style="border: 1px solid black; width:100px" | {| style="border: 2px solid black; background: #ffffcc" | style="border: 2px solid darkgray;" | A |} {| style="border: 2px solid black; background: #ffffcc" | style="border: 2px solid darkgray;" | B | style="border: 2px solid darkgray;" | B |} | style="border: 1px solid black; width: 50px" | {| style="border: 2px solid black; background:#ffffcc; float:left" | style="border: 2px solid darkgray;" | C |} {| style="border: 2px solid black; background:#ffffcc; float:right" | style="border: 2px solid darkgray;" | D |} |} </div> <div class="box"> '''Wikitext:''' <syntaxhighlight lang=wikitext line highlight="4-8,11-17,19-24"> {| style="border: 1px solid black;" | style="border: 1px solid black;" | α | style="border: 1px solid black; text-align:center;" | cell2 {| style="border: 2px solid black; background: #ffffcc;" <!-- The nested table must be on a new line --> | style="border: 2px solid darkgray;" | NESTED |- | style="border: 2px solid darkgray;" | TABLE |} | style="border: 1px solid black; vertical-align: bottom;" | the original table again | style="border: 1px solid black; width:100px" | {| style="border: 2px solid black; background: #ffffcc" | style="border: 2px solid darkgray;" | A |} {| style="border: 2px solid black; background: #ffffcc" | style="border: 2px solid darkgray;" | B | style="border: 2px solid darkgray;" | B |} | style="border: 1px solid black; width: 50px" | {| style="border: 2px solid black; background:#ffffcc; float:left" | style="border: 2px solid darkgray;" | C |} {| style="border: 2px solid black; background:#ffffcc; float:right" | style="border: 2px solid darkgray;" | D |} |} </syntaxhighlight></div>
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)