Архив рубрики: HTML + CSS

Простое выпадающее меню на html и css

index.html:

<!DOCTYPE html>
<html>
<head>
<link rel=»stylesheet» href=»base.css»>
</head>
<body>
<div id=»city-nav»>
<ul>
<li><a href=»#»>Support</a>
<ul>
<li><a href=»http://learn.jquery.com/»>Learning Center</a></li>
<li><a href=»http://try.jquery.com/»>Try jQuery</a></li>
<li><a href=»http://irc.jquery.org/»>IRC/Chat</a></li>
<li><a href=»http://forum.jquery.com/»>Forums</a></li>
<li><a href=»http://stackoverflow.com/tags/jquery/info»>Stack Overflow</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>

base.css:

#city-nav  ul {
text-align: left;
display: inline;
float: left;
margin: 0;
list-style: none;
border-right: 1px solid rgba(255, 255, 255, 0.0976562);
border-left: 1px solid rgba(0, 0, 0, 0.347656);
}

#city-nav  ul li {
display: inline-block;
float: left;
position: relative;
top: 1px;
cursor: pointer;
-webkit-transition: all 0.2s;
transition: all 0.2s;
text-shadow: 0 0px 2px #000;
border-left: 1px solid rgba(255, 255, 255, 0.0976562);
border-right: 1px solid rgba(0, 0, 0, 0.347656);
}

#city-nav  ul li a {
color: #e6e6e6;
text-decoration: none;
display: block;
padding: 8px 12px;
}

#city-nav  ul li ul {
padding: 0;
position: absolute;
top: 32px;
left: -2px;
width: 120px;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
transition: opacity 0.2s;
-webkit-box-shadow: 0 43px 5px rgba(0, 0, 0, 0.4);
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.4);
z-index: 400;
}

#city-nav  ul li ul li {
background: #000;
display: block;
color: #fff;
float: none;
}

#city-nav  ul li ul li:hover { background: #000; }
#city-nav  ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}