In my titlebox I have an icon (<img>) and a title (<h1>). Both are floated to the left.
I would like my title (<h1>) to take up the rest of the width of the box. So if I put text-decoration: underline; on the <h1>, the underline must go on to ’till the end of the box.
JsFiddle: http://jsfiddle.net/44XDa/1/
Basically I want the line under Welcome to go ’till the end of the yellow box.
Can anyone help?
You don’t need to make the
h1float if the only other element in the area is already floating. As the other posters have already pointed out, you probably want to use a border rather than an underline to get this effect. Here are my edits:http://jsfiddle.net/44XDa/36/
The main difference between my solution and those above is that this one doesn’t set a width for the
h1element. This will make it easier if you decide to alter the width of the content-titledivin the future.