Help talk:Table

Add topic
Active discussions
Wikipedia Help Project (Rated NA-class, Mid-importance)
WikiProject iconThis page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the Help Menu or Help Directory. Or ask for help on your talk page and a volunteer will visit you there.
NA This page does not require a rating on the project's quality scale.
 Mid  This page has been rated as Mid-importance on the project's importance scale.

Indenting nested tables is broken?Edit

What is wrong in the following example?

Before table.

Table 1
cell 1
Table 2
cell 2

After table. Should not be indented, but it is.

How to make it work properly? — Mikhail Ryazanov (talk) 12:51, 2 January 2022 (UTC)

(reply not indented to save confusion)
One quick solution would be to add a third column on the left (with a fixed width) to provide the indent.
Before table.

Table 1
cell 1
Table 2
cell 2

After table. No longer indented — GhostInTheMachine talk to me 13:09, 2 January 2022 (UTC)

Another simple fix would be to add <div>...</div> tags around the table.
Before table.

Table 1
cell 1
Table 2
cell 2

After table. — GhostInTheMachine talk to me 13:16, 2 January 2022 (UTC)

Thanks! The second approach seems to be more adequate, since it uses "natural" indents instead of a hard-coded number (which might be different in different skins and might change in future).
If this effect (demonstrated in my first example) is indeed a bug in the parser, maybe it should be investigated and repaired? At least, it would be very useful to mention such problems and workarounds in the help.
And by the way, is there any reliable way to include tables in nested lists in general? For example, tables don't work "as is" even in simple bulleted lists:
  • Item before.
  • {| class="wikitable"

! Header |- | cell |}

  • Item after.
I always struggle with this stuff (especially on discussion pages) and couldn't fine any clear solution... — Mikhail Ryazanov (talk) 13:48, 2 January 2022 (UTC)
Thanks from me as well! Do we know exactly what causes the issue (e.g. whether it is the nested table)? If so, we could add this solution to Help:Table#Indenting tables. AlphaMikeOmega (talk) 16:46, 30 April 2022 (UTC)

(This reply also not indented in attempt to avoid confusion)

It seems that the wikiparser does not close off list items (<li></li> and <dd></dd>) after a table. That's why the After table. Should not be indented, but it is. in the OP's shaded bit is indented; it's (still) part of the <dl><dd> content initiated by the colon just before the table. I did some other tests with an HTML table (<table><caption> etc., not wikimarkup like {| class="wikitable") inside an asterisk-generated bulleted list, and the results were similar; my table appeared nicely, but everything following it (inside or outside my bullet list, including headings) was indented, as part of the identation accompanying the table's list item.

For the basic question asked in the OP, I would consider just adding styling like {| class="wikitable" style="margin-left:4em" Introductory text.

Caption text 2a
Header text Header text Header text
Example Example Example
Example Example Example
Example Example Example

Concluding text. And I realize I'm not using nested tables as mentioned in the original question, as that aspect doesn't really seem germane; it's rather just the problem of a table in a list item.

And as far as the later question goes, about putting a table in an unordered list, I was unable to make it work using asterisk markup, and didn't even try with your {| class="wikitable" coding; I got good results only by forcing the list-item closure by inserting the HTML directly (um, that is, both list markup and table markup, manually; click edit to see my code):

I introduce this list of items, the third of which is a table.

  • Item 1
  • Item 2
  • Caption text 4
    Header text Header text Header text
    Example Example Example
    Example Example Example
    Example Example Example
  • Item 4

And now some concluding text. Happily, it is NOT indented.

Now, while this allows things to "work" on some discussion page, I can't say it's really practical.

If this is a bug in the parser, I guess it should be reported on phab. Or maybe it's already there; I'll go have a look after this. — JohnFromPinckney (talk / edits) 00:49, 3 January 2022 (UTC)

(This reply also not indented in attempt to avoid confusion)

Mikhail Ryazanov. See: Help:Table#Nested tables. Nested tables are very confusing for screen reader users. A better solution is here:

I removed the nesting. And instead of colon indentation I added the left margin to the first div styling:

<div style="display:inline-table; margin-left:4em;">

Before table.

Table 1
cell 1
Table 2
cell 2

After table.

Before table.

<div style="display:inline-table; margin-left:4em;">
{| class="wikitable"
! Table 1
| cell 1
<div style=display:inline-table>
{| class="wikitable"
! Table 2
| cell 2

After table.

As for a bulleted list with tables I did a Google search and found this thread:

It agrees with JohnFromPinckney. --Timeshifter (talk) 04:10, 3 January 2022 (UTC)

Alternating row colors?Edit

This has seemingly never been resolved or addresses. Was this finally abandoned/rejected? Artem S. Tashkinov (talk) 20:00, 2 February 2022 (UTC)

Artem S. Tashkinov. In the future please link directly to the talk section you are talking about. For example:
Help talk:Table/Archive 4#Alternating row colors?
I haven't been doing as much on Wikipedia, so I will not be of much help on this topic, but I thought I could at least make a more direct link. So others might be able to help more easily.
--Timeshifter (talk) 10:27, 30 July 2022 (UTC)

Why "Why <nowiki>"?Edit

The Nested Tables section says Why <nowiki>, seemingly out of a clear blue sky, and then doesn't say anything about <nowiki>. That apparently appeared in this June 13, 2020 edit but I'm not sure what it was intended to convey to the reader then or is intended to convey now. I came here to try to get a handle on hidden tables, and I am pretty foggy on the details of that even without wondering what I'm missing because of the Why <nowiki>. I looked at the wikitext around that in the current page version, which says:

* Why <syntaxhighlight lang="moin" inline><nowiki/></syntaxhighlight>. <!-- Removing the <nowiki/> above to see. -->

but that didn't help much. I tried removing the <nowiki> preceding that line and refreshing the page, but that didn't help either. Does this need to this be clarified, or am I just exceptionally dense this morning? Wtmitchell (talk) (earlier Boracay Bill) 10:11, 8 April 2022 (UTC)

You're right, there was no need for it. In fact there was no need for that example at all. Nesting tables is discouraged, and there is a far simpler example beneath it which adequately explains the technique in case it was ever needed. --Jules (Mrjulesd) 15:52, 10 April 2022 (UTC)

Remove the outlining of tablesEdit


Can someone help me with this request? :) - Klein Muçi (talk) 15:16, 20 April 2022 (UTC)

Not very easy. The styling for wikitables is:
	 * wikitable class for skinning normal tables
	 * keep in sync with commonPrint.css
	table.wikitable {
		margin: 1em 1em 1em 0;
		background-color: #f9f9f9;
		border: 1px #aaa solid;
		border-collapse: collapse;
		color: black;
	table.wikitable > tr > th,
	table.wikitable > tr > td,
	table.wikitable > * > tr > th,
	table.wikitable > * > tr > td {
		border: 1px #aaa solid;
		padding: 0.2em;
	table.wikitable > tr > th,
	table.wikitable > * > tr > th {
		background-color: #f2f2f2;
		text-align: center;
	table.wikitable > caption {
		font-weight: bold;
You could use a TemplateStyle to adjust this to how you like, and then apply it to your table.
Otherwise you would have to use inline css for every element; very messy. Jules (Mrjulesd) 05:29, 21 April 2022 (UTC)
@Mrjulesd, the problem is that I'm really bad with CSS editing so I wouldn't know how to do that in practice. :/ Is that an easy/fast thing to do? Maybe you can do it for me and I can save it somewhere? I just wanted to remove the frame (4 lines: top, bottom, left and right) that outlines the table while keeping everything else intact. - Klein Muçi (talk) 09:31, 21 April 2022 (UTC)

Need a bit of helpEdit

Column 1 Column 2 Column 3 Column 4
AA AB Column 5

How can you make column 5 appear with the same height as the first 3 columns? I use "rowspan="2" but it would not work. I don't want that blank space on top of it. Thanks!--TerryAlex (talk) 19:47, 16 May 2022 (UTC)

Do you mean like this?
Column 1 Column 2 Column 3 Column 4 Column 5
--Jules (Mrjulesd) 20:46, 16 May 2022 (UTC)
Thanks!! :)--TerryAlex (talk) 21:54, 16 May 2022 (UTC)


The advice on indenting tables is bad. A leading colon does not indent; rather, it produces a description list, but without a term, which results in invalid HTML. "The way you'd normally indent anything" is NOT by using a colon, but by using {{block indent}} or CSS. Trying to "indent" something in the middle of a list results in mangled HTML with lists opening and closing repeatedly, which is a disaster for accessibility. Hairy Dude (talk) 18:59, 17 May 2022 (UTC)

Column wider for one row only?Edit

Hello, I'd like to create a table that looks like this:

1Lorem ipsum chapter title42

I.e. the title of the last column should extend to the left as much as it needs space even over the otherwise more narrow width of the column. To create the table above I've used the "colspan" attribute, but that means that the column title is no longer associated to the last column which I assume will be bad for screen readers. Do you have an idea how it would be possible to get the visual result without destroying the logical structure for screen readers? Thanks a lot in advance, --Marsupium (talk) 09:19, 7 June 2022 (UTC)

@Marsupium: I don't think there is a proper way to do that. Alternatively you could use {{abbr}} like p. or {{Vertical header}}. You can use {{soft hyphen}} on long words with multiple syllables so a column can be rendered more narrow when needed. PrimeHunter (talk) 10:22, 7 June 2022 (UTC)
Thanks for your answer! Using abbreviations isn't an option cuz the use case is the transcription of a book on Wikisource so should match the original, see here for a scan of the original. I've done some search on using a "scope" attribute and a workaround could be to use it and set the "dir" attribute of the table from right-to-left, but that sounds like a messy solution, so I guess I might simply have to live with the column remaining slightly wider than desired. :-) --Marsupium (talk) 10:44, 7 June 2022 (UTC)
@Marsupium: This is a help page for the English Wikipedia. I meant no proper way here. Maybe Wikisource accepts more manipulation to try to follow source layout. You can try something like <div style="position: relative; right: 2em;">page</div>. The number can be varied. Don't use px, it relies too much on circumstances for the viewer. The suggested code can also depend on circumstances so you may want to test with different browsers, zoom levels and font sizes if you care about the precise result. PrimeHunter (talk) 11:25, 7 June 2022 (UTC)
Sorry, I should've mentioned that the use case isn't here with the question! Thanks for the the position: relative workaround, it could indeed work. But I think now I've even found a clean solution using id and headers attributes as described by MOS:DTT#Complex tables. (Noting it here as reference for the next one running into a similar problem.) Thanks a lot again! --Marsupium (talk) 11:51, 7 June 2022 (UTC)

How to "wrap" a table based on the device width?Edit

The following table (with {{football kit box}} templates inside each cell) looks fine on desktop view. However, on mobile view, horizontal scrolling is needed to view all the cells. I've been told that scrolling is discouraged. How can I fix the issue? Nehme1499 22:23, 14 June 2022 (UTC)

Monza's first kit in 1912 was blue-and-white.
In 1920 the kit changed to blue-and-white halves.
The first red-and-white kit appeared in 1932.
In 1937–38 and 1961–62, Monza wore stripes.
Variations of a full-red shirt were worn between the 1930s and 2010s...
...which alternated with the white-stripe kit, first introduced in 1971.
Answered at Wikipedia:Help desk#How to "wrap" a table based on the device width? (use Help:Table#Side by side tables). Please only post in one place. PrimeHunter (talk) 00:03, 15 June 2022 (UTC)
My bad, I forgot to remove the topic here. Nehme1499 00:04, 15 June 2022 (UTC)

Row colorEdit

How to make table where even rows has one color while odd — another? (talk) 16:15, 27 July 2022 (UTC)

Is this section higher up of relevance?:
#Alternating row colors?
--Timeshifter (talk) 10:30, 30 July 2022 (UTC)

Request for tableEdit

I was wondering how I could request help on creating a table that would look like this although where I do not have to input the spacing numbers?Patapsco913 (talk) 21:01, 22 August 2022 (UTC)

  Dixmoor / Riverdale
  Posen       Riverdale / Dolton
  Markham      Dolton / Phoenix / South Holland
  Markham       South Holland
  Markham / East Hazelcrest