CSS Class Selectors and ID Selectors


This content has been moved to my new blog at



Comments (5)

  1. cowgaR says:

    Hi Pete,

    I’ve been reading your blog for a while, but this is finaly THE _useful_ entry in the css field you’ve written 🙂 Excellent! We moved to more experienced waters and I hope we’ll stay there.

    Last CSS entries on your blog weren’t bad at all (and considering it is a rarity theme on asp.net blog scene it was nice) but were a bit basic or raw overall…but this one rocks hard!

    very useful post, thank you, combining classes is a very nice feature!

  2. John says:

    Sorry, but I could not see any differences in the styles of the links you mentioned with firefox or ie6.  I can send you a screen shot if you want.

  3. Rosyna says:

    There seems to be a bug in IE7 then. The attribute selector is a[href="http://www.microsoft.com"] but the actual attribute is http://www.microsoft.com/ (note the trailing slash).  If we look at the W3C page on attribute selectors (http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors) it says


    Match when the element’s "att" attribute value is exactly "val".

    It even gives and example of an a href match and says it must be exact. So the fact that it matches in IE7 would be a bug in IE7.

  4. PeteLe says:

    Hi Rosyna,

    Good point!  It wasn’t matching in IE7 for some reason, and I was figuring it had to do with my copy of IE7 being wonky (I’m on a version post beta).  But I just looked, and in fact, it looks like it’s not that, but the rendering engine for the blog edited my html, and added the / to the end so that it didn’t match.  If you look at the one on my website, the one that is linked, it should be okay.


Skip to main content