Help:Zebra

From QED

Revision as of 03:35, 1 April 2009 by Peak (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

class=zebra

If you want the colors of the rows of a table to alternate, add zebra to its list of classes. For example:

{| class="zebra wikitable"
! X !! Y
|-
| 1 || 2
|-
| 1 || 2
|-
| 1 || 2
|}

produces the following table:

X Y
1 2
1 2
1 2

To change the color of the stripes used in one or more "zebra" tables on a page, use the {{stripe}} template. For more specific control over the rows in a table, the {{bgc}} template can be used.

HTML

The same technique can be used for HTML table specifications. For example, the following markup produces the same table as shown above.

<table class="zebra">
<tr>
<th>X</th><th>Y</th>
</tr>
<tr><td> 1 </td> <td> 2 </td> </tr>
<tr><td> 1 </td> <td> 2 </td> </tr>
<tr><td> 31 </td> <td> 2 </td> </tr>
</table>

Technical Note

The CSS specifications for these classes are in MediaWiki:common.css.

See also

Personal tools