white-space 属性指定元素内部空白的处理方式
实例代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
.p1{
white-space:nowrap;
}
</style>
</head>
<body>
<h1>禁用文本换行</h1>
<p class="p1">This is some text.This is some text.This is some text.This is some text.This is some text.This is some text.This is some text.This is some text.This is some text.This is some text.his is some text.</p>
<p style="color:red">请注意文本输出是不换行的。当你拉动浏览器窗口时文本保持>不变。</p>
</body>
</html>
运行效果:
评论