BLOG

IE7 :first-child bug

For those of us that still have to support IE7 (God help us all), there is a yet another loveable lil quirk that we get to enjoy.

If you are using the first-child CSS selector and IE7 seems to be ignoring it, check in your code that there aren’t any html comments or other non-visible bits of stuff in front of the tag you are trying to target. IE7 acts like the general little creep it is and mistakenly factors in these non-visible entities when finding the targets of your CSS selectors. So either remove comments, etc. from before the tag, or adjust the selector accordingly.

.container p:first-child  {
 color:red
}
<div class="container">
<!-- IE7 thinks I am the first-child. Die in a fire IE -->
<p> But I am first-child!! I should totally be red but I ain't :/ </p>
</div>

<div class="container">
<!-- IE7 thinks I am the first-child. Die in a fire IE -->
<p> But I am first-child!! I should totally be red but I ain't :/ </p>
</div>

Welp

Guess I am now in WordPress. And about time, sheesh.

Using the Bones theme from Themble and have to say I feel it’s rather sexy and easy to customize. As I get further along learning WordPress stuffs and pulling apart/rebuilding everything I am sure it’ll just get sexier.

That is all