Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS style TEXT within P, not paragraph element itself

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #40234
    drawby
    Member

    im styling text in a twitter widget so i dont have control of the markup, just the css. i was hoping to give the text within a `

    ` (that is within a div class) a background color on the text but not have the background color run across the entire paragraph element, just behind the text like a highlight . I normally would throw a span in there, but was hoping i could achieve this with just css. any ideas?

    #111598
    Paulie_D
    Member

    Basically I don’t think you can target content within a ‘final’ element.

    The ‘p’, yes, but other than that, I don’t think so.

    Maybe you can target ‘whitespace’ but I’ve never heard of it being done.

    #111599
    Kitty Giraudel
    Participant

    You can’t do this. The regular way is to use a span. It’s meant to.

    With some pseudo-selectors like :first-line, you can partially select some of the content, but not as you wish.

    If your text is purely static, use a background image on the p element.

    #111600
    John
    Participant

    What happens with you type the tag in you're tweet?
    Like if you tweeted "Today I went to the

    #111608
    Kitty Giraudel
    Participant

    Yes.

    #111642
    cnwtx
    Member

    Oh how I wish we had :nth-line(n) But we don’t, at least for now.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.