|
| 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.fancytable {
margin: 1em 1em 1em 0;
background: whitesmoke;
border-collapse: collapse;
}
table.fancytable tr:hover {
background: lightsteelblue !important;
}
table.fancytable th, table.fancytable td {
border: 1px silver solid;
padding: 0.2em;
}
table.fancytable th {
background: gainsboro;
text-align: left;
}
table.fancytable caption {
margin-left: inherit;
margin-right: inherit;
}
The HTML code is very simple with "fancytable" being the only class declaration:
<table class="fancytable">
<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>
If you’ve read the previous article, you’ll notice that both the HTML and the CSS code is identical, except that our new “fancy table” contains one additional declaration:
table.fancytable tr:hover {
background: lightsteelblue !important;
}
Easy, wasn’t it? Again, change the colours to suit your own bad taste. Of course, this won’t work in MSIE, due to it’s buggy CSS behaviour.
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.









Any reason I cannot get this to work in IE?
Yeah, there is Mike. Read the last paragraph of my post.
My bad, now I see it. Do you have any suggestions to a style that would work in both IE and Firefox?
Dean Edwards has a IE7 JS library which makes IE behave like a modern standards-compliant browser, although I'm guessing that it won't work with IE6.
Thanks for your help!
In other words, this won't work for >90% of people looking at your site? Thanks for the advice.
Bosko, I'm not sure how you came to that mathematical conclusion, and I assume that you just took a wild guess, but you're completely wrong. It won't work for <22% of people looking at our site, because 22% is the total ratio of our IE visitors, including IE7, which is much better in terms of the way it understands CSS rules.