Be careful when using comma-separated CSS selectors: IE will ignore the whole rule if it doesn’t understand one of the selectors
July 19th, 2006Today I was wracking my brain, trying to figure out why Internet Explorer wasn’t respecting some of the rules in my CSS file. It finally occurred to me that perhaps it was getting tripped up by the attribute selectors I had grouped into the same rule. IE, of course, doesn’t understand attribute selectors. But I thought it would safely ignore these and apply the properties to the other selectors in the group. Here is what I had:
input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select,
.reply,
.viewQuestion #yourAnswer {
border-color: #ccc;
}
IE was ignoring the gray border I wanted for these elements. It seems stupid to me that it would throw out the whole rule instead of merely ignoring the selectors it didn’t understand and applying the rule to those it did. But it turns out this behavior exactly follows what is in the CSS 2 spec!
To fix my problem, I split my rule into two - one with the attribute selectors, and one without. Not terribly elegant, but the spec doesn’t really leave much choice.
On Friday I ordered a laptop from Dell. I’ve been wanting one for a while, and thanks to a great deal that my friend Rob found, I finally bought one. I am definitely looking forward to using my computer while sitting comfortably on the couch.
My first knitting project that I’ve completed in a while is the