If you want to support the maximum number of browsers, then you need to add some additional markup for this to work:
<h1><span>Header Text</span><span/></h1>
body {
background: url(http://placekitten.com/600/400);
}
h1 {
display: table;
width: 100%;
}
h1 span {
display: table-cell;
white-space: pre;
}
h1 span:last-child {
background: black;
width: 100%;
}
There is a way to do this without additional markup using Flexbox, but it currently only works in Chrome, Opera, IE10, Firefox builds with experimental Flexbox support turned on, and maybe Safari.