Forums

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

Home Forums CSS limit background color to text only, not full width

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44864
    bobbol
    Member

    applying a background-color to the first line of an address in a plain text paragraph; the first line is maybe 20% width but the color spans across the entire page;

    using an in-line style like
    `

    John & Jane Johnson

    `
    using span and div produce same result

    how do I limit the background color to just where the text is?

    #135547
    bobbol
    Member

    `

    John & Jane Johnson

    `

    #135548
    Paulie_D
    Member

    If you want to treat a section of text separately you have to be able to target it.

    In this case, you need to wrap the required text in a span like this

    `

    Jane Johnson

    `

    Although I wouldn’t use inline styling but rather give the span a class and address it my CSS sheet.

    #135560
    bobbol
    Member

    thx Paulie_D! surprised I haven’t encountered this before :/

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