...

View Full Version : Styling a paragraph that is all italics



danosirra
05-01-2006, 10:56 PM
Hi,

Wondering if anyone can help. I want to be able to apply a style to paragraphs that are entirely made up of italics.

So, if I have an italicized word mid-paragraph, I don't want the rule to be applied. But if the entire paragraph is encased in italics tags (i.e. a p followed immediately by an i tag at the beginning, and a closing i tag followed by a closing p tag at the end), then I want the style to be applied.

Please can you tell me how/if this can be done.

Thanks,

Dan.

Arbitrator
05-02-2006, 04:50 AM
You could try p i {foo}. This applies a style to <i> tags that are a descendent of <p> tags. Of course, it'll work on the contents of any <i> within any <p> so you can set classes on the specific <i> you want to affect and use something like p i.STYLENAME {foo}.

So it would work with <body><p><i class="STYLENAME">foo</i></p></body> but not <body><span><i>foo</i></span></body>.

Resource: http://www.w3.org/TR/REC-CSS2/selector.html#descendant-selectors



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum