css 斷行省略符號,隱藏,fixed定位

來源:互聯網
上載者:User

標籤:內容   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定位

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.