您的位置:首页 > Web前端 > HTML5

HTML5基础加强css样式篇(white-space属性)(四十三)

2017-04-07 16:00 615 查看
1.white-space 属性设置如何处理元素内的空白

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.box {
margin: 100px 0 0 100px;
width: 200px;
height: 200px;
background-color: orange;
/*  normal	默认。空白会被浏览器忽略。
pre	        空白会被浏览器保留。其行为方式类似 HTML 中的 <pre> 标签。
nowrap	文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。
pre-wrap	保留空白符序列,但是正常地进行换行。
pre-line	合并空白符序列,但是保留换行符。
inherit	规定应该从父元素继承 white-space 属性的值。*/
/*保留所有的空白*/
white-space: pre;
/*保留换行*/
white-space: pre-line;

white-space: pre-wrap;
}

.box:hover {

}
</style>
</head>
<body>

<div class="box">

function test(){

}

</div>

<script type="text/javascript">
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css html5 经验 html css3
相关文章推荐