I found this fiddle on the following post CSS technique for a horizontal line with words in the middle
Is there anyway to limit the width? I've tried placing a max-width or just width property to both the .group, .item, and .line; however none of it works. I understand there are limitations to placing a width on a display: table-cell.
I have tried the other workarounds on that forum; however they don't work with bootstrap. I need it to work with bootstrap, and I need the background to be transparent (as it's going over an image). Please see the code below:
CSS:
.group {
display: table;
width: 100%;
font-size: 3em;
}
.item {
display: table-cell;
}
.text {
white-space: nowrap;
width: 1%;
padding: 0 10px;
}
.line {
border-bottom: 1px solid #000;
position: relative;
top: -.5em;
}
HTML:
<div class="group">
<div class="item line"></div>
<div class="item text">This is a test</div>
<div class="item line"></div>
</div>