Only apply the property till the text, not whole the line

Posted by Santosh on Stack Overflow See other posts from Stack Overflow or by Santosh
Published on 2012-09-12T21:33:52Z Indexed on 2012/09/12 21:38 UTC
Read the original article Hit count: 405

Filed under:

Here is my the dummy test.

Here is the HTML stuff:

<h1> Header </h1>

Here is the CSS stuff:

body {
 background: pink;
}

h1 {
 background-color: #454545;
}

The webpage is rendered something like this:

                    enter image description here

As you can se in this image, I applied the property to the <h1>, but the whole line has its effect.

What I want is, the gray background till the word "Header", not more than that (Background color is just an example. This is not only the case.).

© Stack Overflow or respective owner

Related posts about css