
Using the General Sibling Selector (CSS)
Sunday, August 22nd, 2010The general sibling selector can be very useful in reducing css code in your style sheets and in your html.
Example:
You have a thumbnail image to the left of a few paragraphs and you don’t want them to wrap below the image.

Instead of using a wrapper div for your paragraphs, you can simple use one declaration:
img ~ p {padding-left:122px;}
This means that all general siblings of an img element will have a left padding value of 122px.
What about older Browsers?
See: http://reference.sitepoint.com/css/generalsiblingselector

In my case, I was not planning on having more than 298 elements, seems excessive. In that case you would want to use a wrapper div for those paragraphs. As for IE6, I say let the text wrap!
