CSS 屬性備忘

來源:互聯網
上載者:User

標籤:nav   代碼   16px   url   不能   over   ima   class   固定   

body {    background: #fff;    color: #444;    font-size:16px;    font-weight:300;    /*設定字型的粗細*/    content:".";            visibility:hidden;  /*/}
content:"."   在寫HTML代碼的時候,發現在Firefox等符合W3C標準的瀏覽器中,如果有一個DIV作為外部容器,內部的DIV如果設定了float樣式, 則外部的容器DIV因為內部沒有clear,導致不能被撐開。這個clearfix的CSS使用了after這個偽對象,它將在應用clearfix的元素的結尾添加content中的內容。 在這裡添加了一個句號".",並且把它的display設定成block;高度設為0;clear設為both;visibility設為隱藏。這樣就達到了撐開容器的目的啦。

visibility:hidden 對象隱藏後,還有佔有相應的空間大小
display:none 對象隱藏後,對象不佔任何空間*
font-weight:300  設定字型的粗細


一.DIV水平垂直置中

1 .col-center-block { 2 float: none; 3 display: block; 4 margin-left: auto; 5 margin-right: auto; 6 transform: translateY(45%); /*高*/7 }

 二.DIV內容置中

  width: auto;    display: table;    margin-left: auto;    margin-right: auto;

 

三.處理溢出內容

 

overflow:scroll;  //溢出出現捲軸
overflow:hidden;  //溢出隱藏

 

四.大的背景圖平鋪不出現捲軸並完整顯示

 

 1 body { 2     background-image: url(../../Content/Image/Navigation/Navigation_bg.jpg); 3     background-repeat: no-repeat; 4     width: 100%; 5     height: 100%; 6     margin:0 auto;                  /*去掉捲軸*/ 7     background-attachment:fixed;    /*背景固定*/ 8     background-size:100% 100%;      /*完整顯示*/ 9 10 }

 

CSS 屬性備忘

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.