I'm going to build this

This is my HTML code.
<div class="al-head-container"> <div></div> <span>Center Websites</span> </div>
This is css:
.al-head-container{ margin: auto; width: 100%; padding:0 4%; position: relative; box-sizing: border-box; } .al-head-container > span{ font: 2.1em titr; color: #ae7f00; background-color: #FFFFFF; position: absolute; right: 0; left:0; } .al-head-container > div{ width: 100%; height: 20px; background-image: url("../image/head-line.jpg"); position: relative; top: 25px; }
But this is the result of the code

The problem is that the span
width is set to 100%, and its width does not match its contents. this is what i get from firebug

As you can see, the text spans a DIV
that contains a string.
I tried setting display:inline-block
for span
but nothing changed. How can I make the absolute set width of the range to fit the content?
source share