Get help. Give help. A Web Design and Development Community.

limit background color to text only, not full width

  • # May 18, 2013 at 3:25 pm

    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?

    # May 18, 2013 at 3:28 pm


    John & Jane Johnson


    # May 18, 2013 at 3:35 pm

    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.

    # May 18, 2013 at 5:00 pm

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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.