Reputation: 387
I have an h4 tag, inside which i have 4 spans and length of text bind to each span tag varies(width of span tag varies). How can i make the span tags appear in same line irrespective of the width?
<h4>
<span class="spanclass">text 1</span>
<span style="white-space: pre-wrap !important">:</span>
<span class="spanclass">text 3</span>
<span class="fa fa-pencil"></span>
</h4>
.spanclass {
white-space: pre-wrap !important;
display: inline-flex!important;
word-wrap: break-word;
word-break: break-all;
}
Please help, Thanks.
Upvotes: 1
Views: 3755
Reputation: 193261
You just need to set white-space: nowrap
with overflow: hidden
on header element:
h4 {
white-space: nowrap;
overflow: hidden;
}
Demo: http://jsfiddle.net/z83wjao9/4/
Upvotes: 2
Reputation: 2536
add min-width to h4 tag :
h4{
min-width: 100px;
}
or you can do like this for responsive design with wrapping : http://jsfiddle.net/z83wjao9/2/
without wrapping : http://jsfiddle.net/z83wjao9/3/
Upvotes: 0