CSS adjacent sibling selectors and IE 6Here’s the problem, which occurs in IE 6/Windows:
Everything below the header, Available Products, should be below the big image. In CSS terms, it should clear the block-level element, and be treated as a new block-level element. Firefox renders it correctly:
The CSS rule that I have in place looks like this:
The element with a class of "pic" is the one with the large picture. If you can imagine a box surrounding that large picture:
The red box above demonstrates how the So, everything after Here is the stripped-down HTML (for the sake of example):
CSS explanationThe CSS code above declares that the image inside the Also, it declares that any element which follows a The CSS selector looks like this:
This is an adjacent sibling selector. Like the term states, it selects an element next to (adjacent) to the specified element. The The plus sign (+) indicates an adjacent sibling selector is about to be declared. And, finally, we are using the star sign (*) to indicate all, or everything. We don’t have to use the star sign (*), if we don't want. We could have it set up so that only That would look like this:
RelatedBut, as mentioned above, IE 6/Windows does not support adjacent sibling selectors - but Firefox, Safari, Opera, and many other browsers do. And... Internet Explorer 7 is right on the horizon, and it will certainly have support for adjacent sibling selectors - among many other CSS advancements. Adam Howell discusses adjacent sibling selectors, in his article about firming up your ASS knowledge.
Comments/Mentions
|
Editor Picks
Email NewsletterSubscribe to the digest newsletter to receive posts by email: Recent Comments
Advertisements
|