好的,我有这个响应式导航,这太棒了:http: //media02.hongkiat.com/responsive-web-nav/demo/index.html
适用于所有东西,直到 Crackberry。出于本演示的目的,我只是在用户的视口小于 480 左右时启动它(换句话说,目前,如果您的视口大于该值,您将看不到导航)。
我正在写作是因为我正在开发一个带有辅助导航的站点(基本上是 ul 中的 ul),但除非用户单击主导航,否则我们不会显示辅助导航。所有这些都是为了保持更短的页面以提高可用性。这是我正在处理的框架:
http://email.gerarddesign.com/nav/index.html
HTML:
<nav class="clearfix">
<ul class="clearfix">
<li><a href="#">services</a>
<ul>
<li><a href="#">branding</a></li>
<li><a href="#">communications</a></li>
<li><a href="#">interactive</a></li>
</ul>
</li>
<li><a href="#">contact</a></li>
</ul>
<a href="#" id="pull">Menu</a>
</nav>
CSS:
/* Clearfix */
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
/* Basic Styles */
body {
background-color: #ece8e5;
}
nav {
height: 40px;
width: 100%;
background: #fff;
font-size: 11pt;
font-family: 'PT Sans', Arial, sans-serif;
position: relative;
}
nav ul {
padding: 0;
margin: 0 auto;
width: 600px;
height: 40px;
}
nav li {
display: inline;
float: left;
}
nav a {
color: #FBA03A;
display: inline-block;
width: 100px;
text-align: center;
text-decoration: none;
line-height: 40px;
/* text-shadow: 1px 1px 0px #999; */
text-transform: uppercase;
}
nav li a {
border-right: 1px solid #576979;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
nav li:last-child a {
border-right: 0;
}
nav a:hover, nav a:active {
background-color: #FBA03A;
color:white;
}
nav a#pull {
display: none;
}
nav ul li ul li {background: url("../images/arroworange.png") 33px center #F2F2F2 no- repeat;
}
nav ul li ul li a {padding-left:25px;}
/*Styles for screen 600px and lower*/
@media screen and (max-width: 600px) {
nav {
height: auto;
}
nav ul {
width: 100%;
display: block;
height: auto;
}
nav li {
width: 100%;
float: left;
position: relative;
}
nav ul li ul li {
width: 100%;
float: left;
position: relative;
}
nav li a {
border-bottom: 1px solid #576979;
border-right: 1px solid #576979;
}
nav a {
text-align: left;
width: 100%;
text-indent: 25px;
}
}
/*Styles for screen 515px and lower*/
@media only screen and (max-width : 480px) {
nav {
border-bottom: 0;
}
nav ul, nav ul ul {
display: none;
height: auto;
}
nav a#pull {
display: block;
background-color: #FBA03A;
width: 100%;
position: relative;
color:#fff;
}
nav a#pull:after {
content:"";
background: url('nav-icon.png') no-repeat;
width: 30px;
height: 30px;
display: inline-block;
position: absolute;
right: 15px;
top: 10px;
}
nav li {
display: block;
float: none;
width: 100%;
}
nav li a {
border-bottom: 1px solid #D4862F;
}
}
请让我知道您是否可以帮助我扩展这个惊人的导航使其更加强大,提前谢谢您!