有没有办法在一行上保留一串文本,这样如果div宽度变小,整个字符串将下降到下一行而不是它的一半?
例:
"Industry Updates - 8th
September 2013"
Run Code Online (Sandbox Code Playgroud)
通常这种情况发生在移动浏览器上,而宽度较小时,理想的情况是整个日期保持在一起给出:
"Industry Updates -
8th September 2013"
Run Code Online (Sandbox Code Playgroud)
那么有没有使用标签或css技巧来实现这一目标?谢谢
JSo*_*ous 63
CSS
.nowrap {
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<span class="nowrap">Industry Updates -</span>
<span class="nowrap">8th September 2013</span>
Run Code Online (Sandbox Code Playgroud)
white-space: nowrap
保留在一条线上的任何元素
thg*_*ell 40
您希望在HTML标记中使用不间断的空间
而不是普通空间.
"Industry Updates - 8th September 2013"
Run Code Online (Sandbox Code Playgroud)