Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Styling a paragraph that is all italics

    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.

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,372
    Thanks
    32
    Thanked 286 Times in 280 Posts
    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/select...dant-selectors
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •