您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“ Css3怎么做響應(yīng)式布局”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
Css3操作響應(yīng)式布局
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{padding: 0;margin: 0;}
html,body{width: 100%;height: 100%;background:url(img/bj.jpg) ;background-size: 100% 100%;}
#nav{width: 560px;height:40px ;margin: 10px auto;}
ul,li{list-style: none;}
.list{width: 560px;height: 40px;background: #fff;}
.list li{width: 50px;height: 40px;margin: 0 10px;float: left;
transition: all 1s;
}
.list li:nth-child(1){
background: url(img/1.png) top;
}
.list li:nth-child(2){
background: url(img/2.png) top;
}
.list li:nth-child(3){
background: url(img/3.png) top;
}
.list li:nth-child(4){
background: url(img/4.png) top;
}
.list li:nth-child(5){
background: url(img/5.png) top;
}
.list li:nth-child(6){
background: url(img/6.png) top;
}
.list li:nth-child(7){
background: url(img/7.png) top;
}
.list li:nth-child(8){
background: url(img/8.png) top;
}
.list li:hover{
background-position: bottom;
}
@media only screen and (min-width: 640px) and (max-width: 980px) {
#nav{position: fixed;top:100px;left:10px;width: 50px;height:400px ;margin: 10px auto;}
ul,li{list-style: none;}
.list{width: 67px;height: 400px;background: #fff;}
.list li{width: 50px;height: 40px;margin: 0 10px;float: left;
transition: all 1s;
}
}
@media only screen and (min-width: 100px) and (max-width: 640px) {
#nav{position: fixed;top:100px;left:10px;width: 50px;height:400px ;margin: 10px auto;}
ul,li{list-style: none;}
.list{width: 67px;height: 400px;background: red;}
/*.list li{width: 50px;height: 40px;margin: 0 10px;float: left;
transition: all 1s;
background: #fff;
}*/
.list li:nth-child(1){
background: url(img/1.png) top;
}
.list li:nth-child(2){
background: url(img/2.png) top;
}
.list li:nth-child(3){
background: url(img/3.png) top;
}
.list li:nth-child(4){
background: url(img/4.png) top;
}
.list li:nth-child(5){
background: url(img/5.png) top;
}
.list li:nth-child(6){
background: url(img/6.png) top;
}
.list li:nth-child(7){
background: url(img/7.png) top;
}
.list li:nth-child(8){
background: url(img/8.png) top;
}
.list li:hover{
background-position: bottom;
}
.list li{width: 50px;height: 40px;margin: 0 10px;float: left;
transition: all 1s;
border-radius: 50%;
}
}
</style>
</head>
<body>
<div id="nav">
<ul class="list">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
效果截圖
“ Css3怎么做響應(yīng)式布局”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。