Reputation: 1006
Is there a way to keep a string of text on one line, so that if the div width gets to small, the whole string will drop to the next line instead of half of it?
Example:
"Industry Updates - 8th
September 2013"
often this happens on mobile browers whereas with to smaller width, the ideal situation is that the whole date stays together giving:
"Industry Updates -
8th September 2013"
So is there a tag to use or a css trick to achieve this? Thanks
Upvotes: 41
Views: 66338
Reputation: 1037
CSS
.nowrap {
white-space: nowrap;
}
HTML
<span class="nowrap">Industry Updates -</span>
<span class="nowrap">8th September 2013</span>
Any element with white-space: nowrap
stays on one line
Upvotes: 87
Reputation: 13256
You want to use a non-breaking space in your HTML markup
instead of a normal space.
"Industry Updates - 8th September 2013"
Upvotes: 56