標籤:內容 round hid padding 模型 顯示 pos top uid
text-overflow(clip | elipsis)(顯示省略符號| 不顯示省略符號)
white-space:nowrap 強制文字不斷行
word-break:break-all; 和 word-break:break-word;
word-break:break-all;不僅把超出的文字斷行還會整齊的排列
word-break:break-word; 把超出的文字強制斷行,其餘的不管,
eg:<p>jflllllllllllllllllllfdjvorfijcdksjhvcidjvcij6789009376567899396767462769hauhfuidhjhfeirhfnjunvreahfvbhjvbujhu</p>
.p1{ width:200px; border:1px solid #000; font:14px/24px Arial; word-wrap:break-word;/*word-break:break-all;*/}
省略符號:
<p class="p2">房間愛家的富婆俄日法搜頂頂頂頂頂頂頂頂頂頂的巨款HREI發的時刻就分開上檔次, 發動機覅開發可可哦靠都快沉客服來得快。</p>
.p2{ width:200px; border:1px solid #000; font:14px/24px Arial;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
盒模型的怪異模式:
box-sizing盒模型解析
content-box 標準盒模型 border-box 怪異模式
width/height=border+padding+content
Border-box 怪異盒模型 width/height=content
可視寬: 元素的內容寬+padding+border
元素的內容寬:元素裡可以方內容的寬
怪異模式:可視寬 設定寬度 內容寬 設定寬度-padding-border
在IE6,7,8下不設定文檔聲明的時候,頁面的盒模型解析 就會進入怪異模式
隱藏方式:
1.display:none;
2.visibility:hidden;
eg:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
div{ width:100px; height:100px; background:red; border:5px solid #333;}
.box1{ display:none;} //隱藏後不保留原來位置,後者補上
.box2{ visibility:hidden;} //隱藏後保留原來位置,
</style>
</head>
<body>
<div class="box1">box1</div>
<div class="box2">box2</div>
<div class="box3">box3</div>
</body>
</html>
fixed不相容問題:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
1.
<style type="text/css">
html{ height:100%; overflow:hidden;}
body{ margin:0; height:100%; overflow:auto;}
.box{ height:2000px;}
.div{ width:100px; height:100px; background:red; position:absolute; left:100px; top:100px;}
</style>
2.
<style type="text/css">
.box{ height:2000px;}
.div{ width:100px; height:100px; background:red; position:fixed; left:100px; top:100px;
_position:absolute;_top:expression(eval(document.documentElement.scrollTop+100));//不建議用,建議用js寫
}
</style>
</head>
<body>
<div class="box">
<div class="div"></div>
</div>
</body>
</html>
css 斷行省略符號,隱藏,fixed定位