css 筆記,css

來源:互聯網
上載者:User

css 筆記,css

css 筆記

第一種:常用的全域CSS屬性設定    //參考大型網站,如鳳凰網(1)清除所有的標記的內外邊距body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0}(2)項目符號ul,ol,li{list-style:none;}(3)全域字型顏色設定body{font-size:12px;color:#444;}(4)常用標題的設定h1,h2,h3,h4,h5,h6{font-size:100%}h1{padding:11px 0 0; margin-bottom:4px;font:normal 20px/30px 黑體;text-align:center;}h2 { padding:6px 0 0; margin-bottom:4px; font:normal 20px/30px 黑體; text-align:center; }h3{font-size:12px}h4{font-size:12px;font-weight:normal}(5)全域連結a{text-decoration:none;cursor:pointer}a:link, a:visited {color:#004276}a:hover{text-decoration:underline;color:#ba2636}(6)圖片img{border:none;}     ie6 圖片有邊框,相容性問題,要去邊框(7)浮動和清除.float1{float:left;}.float2{float:right}.clear{clear:both;}.blank10{height:10px;clear:both;}   添加空白div  解決 div margin 上下邊距會合并,相容性問題(8)顏色.red{color:#FF0000;}.blue{color:#0000FF;}.green{color:#00ff00;}安裝IETEST 測試 ie 6 (1)ie5網頁置中     IE5下的置中,應該是:body{text-align:center} 加上這個,再在最大的div加{text-align:left;}    Firefox下的置中,應該是:margin:0px auto;        body{text-align:center;}    .box{ margin:0 auto; text-align:left;}    <body>        <div class="box">            xx xx xx         </div>    </body>        (2)單行內容垂直中齊    Div{height:80px;line-height:80px;}        (3)IE中元素浮動時,margin左右加倍的問題    解決辦法:Display:inline;          margin:0 auto;  ie6還是不行   問題被 (1)解決margin 左右邊距在Ie6下會加倍,上下邊距會合并,相容性問題上下邊距會合并,在中間加 div{height:10px;}.div1{width:200px;height:200px;background-color:#0000FF;margin:50px;float:left; display:inline;}  //第一個div 的 display為行內樣式 解決"margin 左右邊距在Ie6下會加倍".div2{width:200px;height:200px;background-color:#0000FF;margin:50px;float:left;}<body><div class="div1"></div><div class="div2"></div>    (4)實現1px高度的<div>在IE6下解決辦法:overflow:hidden;  //超出1px外的部分全部隱藏掉<div style="width:100px; height:1px; overflow:hidden;"></div> //超出的部分隱藏掉

 

聯繫我們

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