|
| Key | Value |
|---|---|
| ACT | Australian Capital Territory |
| NSW | New South Wales |
| NT | Northern Territory |
| QLD | Queensland |
| SA | South Australia |
| TAS | Tasmania |
| VIC | Victoria |
| WA | Western Australia |
The CSS code you’ll need, preferably in a separate file:
table.prettytable {
margin: 1em 1em 1em 2em;
background: whitesmoke;
border-collapse: collapse;
}
table.prettytable th, table.prettytable td {
border: 1px silver solid;
padding: 0.2em;
}
table.prettytable th {
background: gainsboro;
text-align: left;
}
table.prettytable caption {
margin-left: inherit;
margin-right: inherit;
}
The HTML code is very simple with "prettytable" being the only class declaration:
<table class="prettytable">
<tr>
<th>Key</th><th>Value</th>
</tr>
<tr>
<td>ACT</td><td>Australian Capital Territory</td>
</tr>
<tr>
<td>NSW</td><td>New South Wales</td>
</tr>
<tr>
<td>NT</td><td>Northern Territory</td>
</tr>
<tr>
<td>QLD</td><td>Queensland</td>
</tr>
<tr>
<td>SA</td><td>South Australia</td>
</tr>
<tr>
<td>TAS</td><td>Tasmania</td>
</tr>
<tr>
<td>VIC</td><td>Victoria</td>
</tr>
<tr>
<td>WA</td><td>Western Australia</td>
</tr>
</table>
Of course, spruce up the colours as much as you like if our monochromatic scheme is a little drab for you.
Some basic rules for commenting:
- Watch your language.
- Keep comments on-topic and relevant.
- You can use basic XHTML tags for formatting and linking but not bbcode.
- Comments are moderated, so don't double post if your comment doesn't appear immediately.
- Please proof-read your comments for spelling and grammar mistakes.
- Watch your language.
Copyright © 1999-2008 Lutrov Communications. Some rights reserved, read the legal stuff.









Thanks for that nice tip, I knew about setting the border on the "td" but I don't remember reading about the "border-collapse", hence my table cells always had that gap you mention.
On a related topic, do you know if it's possible to change the background colour of an entire table row on a "mouseover event" without using javascript? I know how to do this using image rollovers and javascript but I'm wandering if there's some way of doing it using CSS instead.
Thanks. Stay tuned for an upcoming post where I'll talk about exactly that.