7 Replies Latest reply: Oct 11, 2013 3:13 PM by matthew stuart RSS

    CSS background to multiline heading

    matthew stuart Community Member

      Hi all, I am trying to get a background colour behind the text of a heading by CSS. Sometimes it is a single line of text, which works fine, but as soon as it wraps, the background spreads right across the container it's in.

       

      How can I get a colour block to sit behind the heading only allowing for a 5px padding on multi line heading.

       

      Here is an example:

       

      http://news.discovery.com

       

      Notice on the middle image there is a heading (currently the walking dead) doing pretty much what I need, but here I notice it is broken down into a span per word. Is this really how I have to do it, and if so, how do you think they managed to break each word into a span?

       

      Thanks.