以下都是在自己學習 自適應 及響應適 期間總結的經驗
1。針對Body一般在寫網頁是要設置的樣式
body {
margin:0;
padding:0;
width:100%;
height:100%;
}
2。img 標籤需要設置的屬性
img {
border:0;/*去掉邊框。當給圖片加鏈接A標籤是這一點尤爲重要*/
max-width:100%;/*圖片的最大尺寸*/
height:auto;/*圖片高度爲自適應,不給設定固定值,當圖片寬度隨瀏覽器大小變化時,圖片高度會等比例縮放 */
float:left;/*去掉圖片之間間隙*/
}
3。div標籤
div{
width:100%;
max-width:612px;/*設定一個最大寬度*/
margin:0 auto;/*上下:0;左右:自動*/
}
4。去掉div之間的浮動
.clear
{
clear:both;
}
5。去掉A標籤鏈接修飾
a:link { text-decoration: none;color: #fff;}
a:active { text-decoration:none}
a:hover { text-decoration:none;color: <span style="font-family: Arial, Helvetica, sans-serif;">#fff; }</span>
a:visited { text-decoration: none;color: #fff;}
6。關於UL、 Li的使用,一般需要設定的樣式
ul
{
list-style: none;
margin: 0;
padding: 0;
}
li
{
margin: 0;
padding: 0;
float: left;
width: 33.33333%;/*設定li百分比*/
}