码迷,mamicode.com
首页 > Web开发 > 详细

css white-space

时间:2015-06-03 19:33:14      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

  以下是对上面几个属性的测试效果如下:

  技术分享

  具体代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>white-space</title>
	<style type="text/css">
		div{
			width: 1000px;
			background-color: #ddd;
			margin: 0 auto;
		}
		h4{
			height: 40px;
			line-height: 40px;
			background-color: #def;
			font-size: 16px;
			padding-left: 10px;
		}
		.p-normal{
			white-space: normal;
		}
		.p-pre{
			white-space: pre;
		}
		.p-nowrap{
			white-space: nowrap;
		}
		.p-pre-wrap{
			white-space: pre-wrap;
		}
		.p-pre-line{
			white-space: pre-line;
		}
	</style>
</head>
<body>
	<div>
	<h4>white-space: normal</h4>
		<p class="p-normal">this    is  
			a 


			test !
		</p>
	</div>
	<div>
		<h4>white-space: pre</h4>
		<p class="p-pre">this    is                           显示数据库操作命令,里面有很多的命令 db.foo.help(:显示集合操作命令,同样有很多的命令,foo指的是当前数据库下,一个叫foo的集合,并非真正意义上的命令 
			a 


			test !
		</p>
	</div>
	<div>
			<h4>white-space: nowrap</h4>
		<p class="p-nowrap">this    is  
			a 


			test !
		</p></div>
		<div>
					<h4>white-space: pre-wrap</h4>
			<p class="p-pre-wrap">this    is                            显示数据库操作命令,里面有很多的命令 db.foo.help(:显示集合操作命令,同样有很多的命令,foo指的是当前数据库下,一个叫foo的集合,并非真正意义上的命令 
				a 


				test !
			</p>
		</div>
		<div>
							<h4>white-space: pre-line</h4>
			<p class="p-pre-line">this    is  
				a 


				test !
			</p>
		</div>
	</body>
</html>

  

css white-space

标签:

原文地址:http://www.cnblogs.com/junjieok/p/4549717.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!