My goal is to create a unique display using CSS:
I want to add various texts and lines to fill in the white space on the left and right sides.
I have made some progress with this http://jsfiddle.net/g5jtm/, but I am facing a few issues:
- The text width varies and removing
width:40%;
affects the other 2 lines - The
display:table
property does not allow me to vertically align the lines in the middle of the text
Example HTML structure:
<div class="container">
<div class="lines l1"></div>
<div class="copy">Consumer review</div>
<div class="lines l2"></div>
</div>
Example CSS styles:
.container {width:100%; display:table; position:relative; height:100px;}
.lines, .copy {display:table-cell;vertical-align: middle;width:auto; }
.copy { white-space: nowrap; padding:3px; text-align:center; font-size:24px; width:40%;}
.l1,.l2 {border-bottom:1px solid red; height:50px; }