Hello, all. I'm trying to do a test on taming lists with CSS, and I've run into a snag. I'm trying to get the word "and" to appear before the final list item by using ul.tame > li:last-child:before {content: " and ";} This should hypothetically work; this example was modified from the list of CSS3 selectors (<!-- m --><a class="postlink" href="http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#last-child-pseudo">http://www.w3.org/TR/2001/CR-css3-selec ... ild-pseudo</a><!-- m -->), but it doesn't, nor does :last-child work at all in any of my experiments. I thought it was supported by Firefox 0.9, but maybe I'm wrong or I just had a syntax error. Thanks in advance.
The list is just a normal list of links, with the class name "tame", with a paragraph (class="ul-int"; <ul> intro) before it. The CSS is as follows: ul.tame, p.ul-int {margin: 0; list-style: none; display: inline; padding: 0; }
ul.tame li {display: inline;}
ul.tame li:after {content: ", ";}
ul.tame > li:last-child:before {content: " and";}
ul.tame > li:last-child:after {content: ".";}Works for me with Moz.1.6, FF0.9. Opera ok except for " and " and IE just does the inline.*Feels stupid* When you said that, I started up a whole new page to test it out, and I know why it wasn't working. All my previous tests were styling a generated list= and the </ul> tag was never generated. Oops. I guess this is what happens when you're tired... it's 5am and I'm still not tired.. bleh.
Well, thanks, Fang. Now, I have to test some of those other pseudo classes- they might be useful, especially if I decide to give my xBlogLite an actual comments style. The last-child pseudo not working was making me think none of the obscure ones did.
The list is just a normal list of links, with the class name "tame", with a paragraph (class="ul-int"; <ul> intro) before it. The CSS is as follows: ul.tame, p.ul-int {margin: 0; list-style: none; display: inline; padding: 0; }
ul.tame li {display: inline;}
ul.tame li:after {content: ", ";}
ul.tame > li:last-child:before {content: " and";}
ul.tame > li:last-child:after {content: ".";}Works for me with Moz.1.6, FF0.9. Opera ok except for " and " and IE just does the inline.*Feels stupid* When you said that, I started up a whole new page to test it out, and I know why it wasn't working. All my previous tests were styling a generated list= and the </ul> tag was never generated. Oops. I guess this is what happens when you're tired... it's 5am and I'm still not tired.. bleh.
Well, thanks, Fang. Now, I have to test some of those other pseudo classes- they might be useful, especially if I decide to give my xBlogLite an actual comments style. The last-child pseudo not working was making me think none of the obscure ones did.