Wikipedia:Manual of Style/Accessibility/Data tables tutorial: Difference between revisions

Content deleted Content added
use syntaxhighlight instead of pre
Line 15:
* Difficulty: easy (the syntax is fairly simple and editors get used to it; the layout might change users' habits)
 
<syntaxhighlight lang="wikitext">
<pre>
{| class="wikitable"
|+ caption text
Line 29:
| data 3 || data 4
|}
</syntaxhighlight>
</pre>
which gives:
{| class="wikitable"
Line 53:
 
To use <code>plainrowheaders</code>, place it (like <code>wikitable</code>) in the <code>class=</code> attribute at the beginning of the table. The example below shows custom row header style using a larger font instead of boldfacing:
<syntaxhighlight lang="wikitext">
<pre>
{| class="wikitable plainrowheaders"
! scope="row" style="font-size: larger;" | row header 1
</syntaxhighlight>
</pre>
 
== Proper table captions and summaries ==
Line 626:
|}
 
<syntaxhighlight lang="wikitext">
<pre>
{| class="wikitable"
|
Line 651:
|}
|}
</syntaxhighlight>
</pre>
 
By comparison, using rowspan would not only need careful juggling of the positions and values but would break normal flow, splitting up each data subset and even causing Insert 3down and Insert 4down to be read in the wrong order:
Line 668:
|}
 
<syntaxhighlight lang="wikitext">
<pre>
{| class="wikitable"
| Insert 1up
Line 681:
| Insert 3down
|}
</syntaxhighlight>
</pre>
 
CSS also has table display properties which can be applied to other elements such as divs, and could be used to create the layout with correct normal flow. But it requires a custom stylesheet defining the various classes of substitute entity. Moreover, it breaks the formal separation of HTML structure vs. CSS styling by using the styling language to render the correct structure onscreen. It is unnecessary and is not recommended.
 
== Resources ==