移動端nav導覽列

來源:互聯網
上載者:User

標籤:設定   樣式   沒有   cti   text   ack   list   red   float   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=750,user-scalable=no" />
<title>導覽列</title>
<link rel="stylesheet" href="css/nav.css" />
</head>
<body>
<nav class=‘nav-sub‘>
<ul>
<li><a href="">&gt;</a></li>
<li><h3>導覽列</h3></li>
<li>
<div class="btn show">
<span></span>
<span></span>
<span></span>
</div>
</li>
</ul>
<section class="sub-nav-list">
<ul>
<li>
<a href="">首頁1</a>
</li>
<li>
<a href="">首頁2</a>
</li>
<li>
<a href="">首頁3</a>
</li>

<li>
<a href="">首頁4</a>
</li>
<li>
<a href="">首頁5</a>
</li>
<li>
<a href="">首頁6</a>
</li>
</ul>
</section>
</nav>
<script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

$(".btn").click(function(){
$(".sub-nav-list").slideToggle(100);
$(this).toggleClass(‘show‘);
})
</script>


</body>
</html>

 

樣式

*{
margin:0;
padding: 0;
border:0;
}

ul,li{
list-style: none;
}
nav{
overflow: hidden;
background: gold;

 

//為什麼display: inline-block;設定li.33.33%還擠出去,是因為沒有給ul字型設定0;
>ul{
width:100%;
padding: 0px 20px;
box-sizing: border-box;
font-size: 0px;
>li{
display: inline-block;
width: 33.33%;
height: 100px;
line-height: 100px;
text-align: center;
font-size:30px;
color:white;

>a{
float:left;
text-decoration: none;
}
>div.btn{
float: right;
margin-top:20px;
width: 50px;
position: relative;
>span{
display: block;
width:50px;
height: 3px;
background: darkgoldenrod;
margin-top:10px;
transition: all 0.4s;
}
}
>div.show{
margin-top: 40px;
>span:first-child{
transform-origin: center center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
transform: rotate(45deg);
}

>span:nth-child(2){
display: none;
margin: 0;
}

>span:last-child{
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
transform: rotate(-45deg);
}
}
}
}
>section{
>ul{
font-size: 0px;
>li{
width:33.33%;
margin-bottom: 20px;
display: inline-block;
border:1px solid red;
font-size: 16px;
text-align: center;
box-sizing: border-box;
}
}
}
}

移動端nav導覽列

相關文章

聯繫我們

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