Forum:Tables need headers: Difference between revisions
(Created page with "{{Forumheader|Tech notes}} <!-- Please put your content under this line. Be sure to sign your edits with four tildes ~~~~ --> I've been noticing some errors with table creation,...") |
m (Sorry for having to do this, but I'm being forced to change my sig, and clean up after it, by Wikia Staff) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Forumheader|Tech notes}} | {{Forumheader|Tech notes}} | ||
<!-- Please put your content under this line. Be sure to sign your edits with four tildes ~~~~ --> | <!-- Please put your content under this line. Be sure to sign your edits with four tildes ~~~~ --> | ||
Although it can be intimidating at first, making a table in wikicode is actually pretty easy, particularly because we've made it simple to style tables using {{tlx|prettytable}}. But you do have to know what all the little symbols do: | |||
{|{{prettytable}} | {|{{prettytable}} | ||
!Symbol||What it does | !Symbol||What it does | ||
Line 16: | Line 13: | ||
| <tt><nowiki>||</nowiki></tt> || declares the '''end of a cell''' | | <tt><nowiki>||</nowiki></tt> || declares the '''end of a cell''' | ||
|- | |- | ||
| <nowiki>|</nowiki> || declares a new '''row''' | | <nowiki>|</nowiki> || declares the '''start of a new row''' | ||
|- | |||
| <nowiki>|-</nowiki> || declares the '''end of a row''' | |||
|- | |- | ||
|} | |} | ||
What's really important here is the '''difference between a pipe (|) and an exclamation point (!).''' If you start the second line of your table — that is, the line that has all the column titles — with a pipe, you'll still get a table. But the resulting table will have no true header. | |||
For instance, | For instance, an awful lot of tables '''wrongly''' use the pipe like this: | ||
<pre> | <pre> | ||
Line 28: | Line 27: | ||
| Writer || Director || Producer | | Writer || Director || Producer | ||
|- | |- | ||
| Russell T Davies || Euros Lyn | Phil Collinson | | Russell T Davies || Euros Lyn || Phil Collinson | ||
|- | |- | ||
|} | |} | ||
Line 62: | Line 61: | ||
Notice that you can, if you wish, use multiple exclamation points: | Notice that you can, if you wish, use multiple exclamation points: | ||
{| {{ | {| {{prettytable}} | ||
!Method A || Method B | !Method A || Method B | ||
|- | |- | ||
|You can | |You can start the line with an exclamation point and then separate each new header with double pipes like this:<pre>! Writer || Director || Producer</pre>||Or you can put one header per line, and start each line with an exclamation point. It's the same thing.<pre>! Writer | ||
!Director | !Director | ||
!Producer</pre> | !Producer</pre> | ||
Line 71: | Line 70: | ||
|} | |} | ||
{{user:CzechOut/Sig}} | {{user:CzechOut/Sig}}{{User:CzechOut/TimeFormat}}05:51: Mon 14 May 2012 </span> |
Latest revision as of 04:26, 28 August 2012
If this thread's title doesn't specify it's spoilery, don't bring any up.
Although it can be intimidating at first, making a table in wikicode is actually pretty easy, particularly because we've made it simple to style tables using {{prettytable}}. But you do have to know what all the little symbols do:
Symbol | What it does |
---|---|
{| | starts a table |
|} | ends a table |
! | declares that this row will define column header(s) |
|| | declares the end of a cell |
| | declares the start of a new row |
|- | declares the end of a row |
What's really important here is the difference between a pipe (|) and an exclamation point (!). If you start the second line of your table — that is, the line that has all the column titles — with a pipe, you'll still get a table. But the resulting table will have no true header.
For instance, an awful lot of tables wrongly use the pipe like this:
{| {{prettytable}} | Writer || Director || Producer |- | Russell T Davies || Euros Lyn || Phil Collinson |- |}
This produces the following:
Writer | Director | Producer |
Russell T Davies | Euros Lyn | Phil Collinson |
Okay, that's a table, technically. But it's got no header. See how you can mouseover the first row just as easily as the second? That shouldn't be happening.
What you need to do, therefore, is to actually declare the writer/director/producer line as the table header. You do this by beginning that line with an exclamation mark, not a pipe. Here's the right way to make a table with wikicode:
{| {{prettytable}} ! Writer || Director || Producer |- | Russell T Davies || Euros Lyn || Phil Collinson |- |}
It's a tiny change. But notice the dramatic difference in the output:
Writer | Director | Producer |
---|---|---|
Russell T Davies | Euros Lyn | Phil Collinson |
Notice that you can, if you wish, use multiple exclamation points:
Method A | Method B |
---|---|
You can start the line with an exclamation point and then separate each new header with double pipes like this:! Writer || Director || Producer |
Or you can put one header per line, and start each line with an exclamation point. It's the same thing.! Writer !Director !Producer |