How to display <ul>
elements as a flat comma-separated list (now in effect in the main menu and links list in the left-hand column):
ul.links { list-style: none; margin: 0; padding: 0; } ul.links li { display: inline; } ul.links li:after { content: ","; } ul.links li:last-child:after { content: ""; }
The advantage of this is that changing the default separator from a comma to |
or -
or whatever now means only having to change one character in the stylesheet.
Note: Internet Explorer doesn't support the css content
attribute or :after
and :last-child
pseudo-classes, so the commas won't appear in IE.
ul.links li:after { content: ","; }
ul.links li:last-child:after { content: ""; }
Now the commas aren't part of the hyperlink, which I prefer. :)
I've updated the code sample (and my stylesheet).
ul.links li:last-child:after { content: "."; }
...because of all the commas. I think it looks better with a full-stop at the end. But hey, that's just me.
ul.links li:first-child:before { content: ""; }
ul.links li:last-child::before { content: " and "; }
Example output:
One, two, three and four
One ,two ,three and four
which is not quite the same.
One ,two
but as
One,two
which would be easy to solve by
content: ", "
I was gonna say that; you beat me to it. Anyway, if you _would_ remove the whitespace or if the css3 rule would work, my vote would go out to:
ul.links li:before { content: ", "; }
ul.links li:first-child { text-transform: capitalize; }
ul.links li:first-child:before { content: ""; }
ul.links li:last-child:before { content: " and last but not least: "; }
ul.links li:last-child:after { content: "."; }
I was going for something like "ul.links li:first-child:first-letter { text-transform: uppercase; }", but that didn't work.
:)
ul.links li:first-child a:first-letter { text-transform: uppercase; }
*would* work, but it also doesn't.
works ;)
Re #6, I'll post an example later if I can get it to work.
Your favicon is black-on-transparent, and too large (32x32) to be visible as a background-image in your name-link, meaning it won't even show now that I've fixed the detection! :)