html基礎知識點

來源:互聯網
上載者:User

標籤:span   閱讀   知識點   list   height   html   ext   lin   center   

語義化:根據內容的結構化選擇合適的標籤,便於開發人員閱讀和寫出優雅的代碼的同時讓瀏覽器的爬蟲和機器很好的解析。
標準文檔流:在沒有css的幹預下,區塊層級元素獨佔一行可以設定寬高,行內元素並排顯示寬高。
浮動:子級浮動會導致父級塌陷高度,行內元素浮動後改變了dispaly屬性,可以設定寬高,元素浮動不會穿過padding地區,浮動脫離文檔流影響別的元素。
製作一個導航
代碼實現:

    

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
body{margin: 0px;
}
.c1{display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;

}
.c2 {
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: 0px -20px;
}
.c3 {
display: block;
float: left;
width: 22px;
height: 19px;
background: url("sucai.png") no-repeat;
background-position: 0px -45px;
}
.c4{
display: block;
float: left;
width: 22px;
height: 17px;
background: url("sucai.png") no-repeat;
background-position: 0px -63px;
}
.c5{
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: 0px -81px;
}
.c6{
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: 0px -101px;
}
ul{margin: 0px;
padding: 0px;
}
li{
float: left;
list-style: none;
text-align: center;
margin-left:120px;
}
li>a{
text-decoration: none;
color:yellow;
font-size: 8px;
}
li:hover a{
background: linear-gradient(green,red);
}
.c1:hover{display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: -21px -0px;
}
.c2:hover {
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: -21px -20px;
}
.c3:hover{
display: block;
float: left;
width: 22px;
height: 19px;
background: url("sucai.png") no-repeat;
background-position: -22px -44px;
}
.c4:hover{
display: block;
float: left;
width: 22px;
height: 17px;
background: url("sucai.png") no-repeat;
background-position:-21px -63px;
}
.c5:hover{
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: -22px -81px;
}
.c6:hover{
display: block;
float: left;
width: 22px;
height: 20px;
background: url("sucai.png") no-repeat;
background-position: -21px -101px;
}

</style>
</head>
<body>
<nav>
<ul>
<li>
<span class="c1"> </span>
<a href="#">茄子</a>
</li>
<li>
<span class="c2"> </span>
<a href="#">香蕉</a>
</li>
<li>
<span class="c3"> </span>
<a href="#">草莓</a>
</li>
<li>
<span class="c4"> </span>
<a href="#">馬鈴薯</a>
</li>
<li>
<span class="c5"> </span>
<a href="#">蘋果</a>
</li>
<li>
<span class="c6"> </span>
<a href="#">橘子</a>
</li>

</ul>
</nav>
</body>
</htm

html基礎知識點

聯繫我們

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