Help:Tables

From Ballotpedia
Jump to: navigation, search
:Category:Help

This page includes information about how to build tables.

Basic table

Type Title Subject
A B Trees
C D Plants

The code for that table can be typed like this:

{|class="wikitable" 
|-
! Type
! Title
! Subject 

|-
| A || B || Trees

|-
| C || D || Plants

|}

...or like this:

{|class="wikitable" 
! Type
! Title
! Subject 

|-
| A 
| B 
| Trees

|-
| C 
| D 
| Plants

|}

The advantage of using the second method is that it tends to be easier on the eye. The disadvantage of using the second method is that if you have a table with a lot of rows in it, you or the next person to edit the page will have to do much more scrolling to get to the line that needs editing.

Width of table

You can determine the width of the table:

Type Title Subject
A B Trees
C D Plants
Type Title Subject
A B Trees
C D Plants
Type Title Subject
A B Trees
C D Plants
Chart width.PNG

To set the width of the table, you insert code in the "class" line that expresses a percent. The number you insert is your preference for how much of the page you want the table to take up.

Add color

To the table header

Dark background

Type Title Subject
A B Trees
C D Plants

The code that creates the above table looks like this:

{|class="wikitable" 
! style="background-color:#00008B; color: white;" | Type
! style="background-color:#00008B; color: white;" | Title
! style="background-color:#00008B; color: white;" | Subject

|-valign="top"
| A 
| B 
| Trees

|-valign="top"
| C 
| D 
| Plants

|}

Light background

Type Title Subject
A B Trees
C D Plants

The code that creates the above table looks like this:

{|class="wikitable" 
! style="background-color:#7FFFD4" | Type
! style="background-color:#7FFFD4" | Title
! style="background-color:#7FFFD4" | Subject

|-valign="top"
| A 
| B 
| Trees

|-valign="top"
| C 
| D 
| Plants

|}

To a row

Type Title Subject
A B Trees
C D Plants

The code that creates the above table looks like this:

{|class="wikitable" 
! Type
! Title
! Subject 

|- style="background-color:#A4C639"
| A 
| B 
| Trees

|- style="background-color:#00FFFF"
| C 
| D 
| Plants

|}

To a cell

Type Title Subject
A B Trees
C D Plants

The code that creates the above table looks like this:

{|class="wikitable" 
! Type
! Title
! Subject 

|-
| style="background-color:#A4C639" | A 
| style="background-color:#FAEBD7" | B 
| style="background-color:#FFA812" | Trees

|-valign="top"
| style="background-color:#918151" | C 
| style="background-color:#00FFFF" | D 
| style="background-color:#B2EC5D" | Plants

|}

Color codes

To find the codes for different colors, check out this list of colors and their codes from Wikipedia.

Complex tables

Columns that span multiple rows

You may wish to have one or more of your column headings span more than one row. Here are some examples that you can customize for the effect you want.

State 2010 2009
Not on ballot On ballot Not on ballot On ballot
Abandoned Judicial invalidation Resignation Recalled Retained Abandoned Judicial invalidation Resignation Recalled Retained
Alaska 1 1
2010 school bond question election overview
Status Number Dollars District % Dollar %
Approveda Approved 61 $5,053,250,000 73.5% 89.75%
Defeatedd Defeated 22 $576,950,000 26.5% 10.25%
Totals: 83 $5,630,200,000 100% 100%
Measure K
County: Yes No
Votes  % Votes  %
Los Angeles County 4,290 56.60% 3,290 43.40%
Ventura County 170 59.03% 118 40.97%
Totals: 4,460 56.69% 3,408 43.31%

Rows that span multiple columns

Here's an example that you can customize for your purposes:

Ballot measure Main website FaceBook 24x24.png Facebook Twitter bird.png Twitter Youtube small.png YouTube
Prop. 103 Yes on 103 Yes on 103 Yes on 103 4COed
Compass Colorado Compass Colorado Compass Colorado No website

External links