Simple responsive menu

HTML


<nav class="nav">
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Projects</a></li>
        <li class="current"><a href="#">Contact Us</a></li>
      </ul>
    </nav>

CSS


.nav {
	margin: 23px 0;
	width:40%;
	float:right;
	text-align:right;
}
.nav ul {
	margin: 0;
	padding: 0;
}
.nav li {
	margin: 0 5px 10px 0;
	padding: 0;
	list-style: none;
	display: inline-block;
 *display:inline; /* ie7 */
}
.nav a {
	padding: 3px 12px;
	text-decoration: none;
	color: #ffffff;
	line-height: 100%;
}
.nav a:hover {
	color: #ffffff;
}
.nav .current a {
	color: #510900;
	border-radius: 5px;
}
@media screen and (max-width: 768px) {
	#hdcontainer {
		width:90%;
	}
	.nav {
		width:73%;
		position: relative;
		min-height: 40px;
		margin: 15px 0;
	}
	.nav ul {
		width: 235px;
		padding: 5px 0;
		position: absolute;
		top: 0;
		left: 0;
		border: solid 1px #aaa;
		background: #E2E2E2 url(images/icon-menu.png) no-repeat 185px 12px;
		-webkit-border-radius: 5px;
		-moz-border-radius: 5px;
		border-radius: 5px;
		behavior: url(js/PIE.htc);
		box-shadow: 0 1px 2px #898989;
		-moz-box-shadow:0 1px 2px #898989;
		-webkit-box-shadow: 0 1px 2px #898989;
		filter: progid:DXImageTransform.Microsoft.Shadow(Color=#000000, Strength=4, Direction=70), progid:DXImageTransform.Microsoft.Shadow(Color=#000000, Strength=4, Direction=140);
		behavior: url(js/PIE.htc);
		z-index:6000;
	}
	.nav li {
		display: none; /* hide all 
  • items */ margin: 0; } .nav .current { display: block; /* show only current
  • item */ } .nav a { display: block; padding: 5px 5px 5px 32px; text-align: left; color:#EC3002; } .nav a:hover { color: #000000; } .nav .current a { background: none; color: #000000; } /* on nav hover */ .nav ul:hover { background-image: none; } .nav ul:hover li { display: block; margin: 0 0 5px; color:#000000; } .nav ul:hover .current { background: url(images/icon-check.png) no-repeat 10px 7px; } }

    You may also like

    Leave a Reply

    Your email address will not be published. Required fields are marked *