Reputation: 1016
I want to make my background follow the width of my text on every line. So instead of following the box I want the background color to follow the width of the text on each line.
E.g.:
--------------
| This is |
| the normal |
| behaviour. |
--------------
-----------
| This is |____
| what I want |
| to happen |
-------------
Is this in anyway possible in CSS?
Upvotes: 0
Views: 1262
Reputation: 589
I have an even easier solution:
p {
background: red;
display:inline;
}
Fiddle here: http://jsfiddle.net/zz7z2/2/
Upvotes: 1
Reputation: 16438
You can do something like this but it's ugly
<span>sad asda sdas</span>
<span>sad asda sdas sadsd ad s</span>
CSS
span {
background: green;
padding: 0;
margin: 0;
clear: both;
float: left;
}
Upvotes: 1