hii,
i am sharing a simple responsive menu code i.e html and css which you can use whenever you want to create a responsive menu.
HTML:
<div id='Responsivemenu'>
<ul>
<li class='first'><a href='#'><span>Home</span></a></li>
<li><a href='#'><span>Products</span></a></li>
<li><a href='#'><span>Company</span></a></li>
<li class='last'><a href='#'><span>Contact</span></a></li>
</ul>
</div>
CSS:
#Responsivemenu {
background: #0693CA;
width: auto;
}
#Responsivemenu ul {
list-style: none;
margin: 0;
padding: 0;
line-height: 1;
display: block;
zoom: 1;
}
#Responsivemenu ul:after {
content: " ";
display: block;
font-size: 0;
height: 0;
clear: both;
visibility: hidden;
}
#Responsivemenu ul li {
display: inline-block;
padding: 0;
margin: 0;
}
#Responsivemenu.align-right ul li {
float: right;
}
#Responsivemenu.align-center ul {
text-align: center;
}
#Responsivemenu ul li a {
color: #ffffff;
text-decoration: none;
display: block;
padding: 15px 25px;
font-family: 'Open Sans', sans-serif;
font-weight: 700;
text-transform: uppercase;
font-size: 14px;
position: relative;
transition: color .25s;
}
#Responsivemenu ul li a:hover {
color: #333333;
}
#Responsivemenu ul li a:hover:before {
width: 100%;
}
#Responsivemenu ul li a:after {
content: "";
display: block;
position: absolute;
right: -3px;
top: 19px;
height: 6px;
width: 6px;
background: #ffffff;
opacity: .5;
}
#Responsivemenu ul li a:before {
content: "";
display: block;
position: absolute;
left: 0;
bottom: 0;
height: 3px;
width: 0;
background: #333333;
transition: width .25s;
}
#Responsivemenu ul li.last > a:after,
#Responsivemenu ul li:last-child > a:after {
display: none;
}
#Responsivemenu ul li.first a {
color: #333333;
}
#Responsivemenu ul li.first a:before {
width: 100%;
}
#Responsivemenu.align-right li.last > a:after,
#Responsivemenu.align-right li:last-child > a:after {
display: block;
}
#Responsivemenu.align-right li:first-child a:after {
display: none;
}
@media screen and (max-width: 768px) {
#Responsivemenu ul li {
float: none;
display: block;
}
#Responsivemenu ul li a {
width: 100%;
box-sizing: border-box;
border-bottom: 1px solid #000000;
}
#Responsivemenu ul li.last > a,
#Responsivemenu ul li:last-child > a {
border: 0;
}
#Responsivemenu ul li a:after {
display: none;
}
#Responsivemenu ul li a:before {
display: none;
}
}
0 Comment(s)