演示效果截图
用到的图片
CSS代码
body {
padding: 50px;
margin: 0;
}
ul.green {
padding: 5px;
margin: 10px 0;
list-style: none;
background-color: #fff;
border-bottom: 1px solid #e7e7e7;
float: left;
clear: left;
}
ul.green li {
float: left;
}
ul.green li a {
float: left;
text-decoration: none;
color: #ccc;
padding: 4px 15px 0 0;
margin-right: 8px;
font: 900 14px "Arial", Helvetica, sans-serif;
}
ul.green li a span {
float: left;
padding-right: 15px;
display: block;
margin-top: -4px;
height: 24px;
}
ul.green li a:hover {
color: #576d07;
background: url(images/green.png) no-repeat top right;
}
ul.green li a:hover span {
background: url(images/green.png) no-repeat top left;
}
ul.green li a.current {
background: url(images/green.png) no-repeat top right;
color: #576d07;
}
ul.green li a.current span {
background: url(images/green.png) no-repeat top left;
}
ul.blue {
padding: 5px;
margin: 10px 0;
list-style: none;
background-color: #fff;
border-bottom: 1px solid #e7e7e7;
float: left;
clear: left;
}
ul.blue li {
float: left;
}
ul.blue li a {
float: left;
text-decoration: none;
color: #ccc;
padding: 4px 15px 0 0;
margin-right: 8px;
font: 900 14px "Arial", Helvetica, sans-serif;
}
ul.blue li a span {
float: left;
padding-right: 15px;
display: block;
margin-top: -4px;
height: 24px;
}
ul.blue li a:hover {
color: #0d5f83;
background: url(images/blue.png) no-repeat top right;
}
ul.blue li a:hover span {
background: url(images/blue.png) no-repeat top left;
}
ul.blue li a.current {
background: url(images/blue.png) no-repeat top right;
color: #0d5f83;
}
ul.blue li a.current span {
background: url(images/blue.png) no-repeat top left;
}
ul.pink {
padding: 5px;
margin: 10px 0;
list-style: none;
background-color: #fff;
border-bottom: 1px solid #e7e7e7;
float: left;
clear: left;
}
ul.pink li {
float: left;
}
ul.pink li a {
float: left;
text-decoration: none;
color: #ccc;
padding: 4px 15px 0 0;
margin-right: 8px;
font: 900 14px "Arial", Helvetica, sans-serif;
}
ul.pink li a span {
float: left;
padding-right: 15px;
display: block;
margin-top: -4px;
height: 24px;
}
ul.pink li a:hover {
color: #860737;
background: url(images/pink.png) no-repeat top right;
}
ul.pink li a:hover span {
background: url(images/pink.png) no-repeat top left;
}
ul.pink li a.current {
background: url(images/pink.png) no-repeat top right;
color: #860737;
}
ul.pink li a.current span {
background: url(images/pink.png) no-repeat top left;
}
ul.red{
padding: 5px;
margin: 10px 0;
list-style: none;
background-color: #fff;
border-bottom: 1px solid #e7e7e7;
float: left;
clear: left;
}
ul.red li {
float: left;
}
ul.red li a {
float: left;
text-decoration: none;
color: #ccc;
padding: 4px 15px 0 0;
margin-right: 8px;
font: 900 14px "Arial", Helvetica, sans-serif;
}
ul.red li a span {
float: left;
padding-right: 15px;
display: block;
margin-top: -4px;
height: 24px;
}
ul.red li a:hover {
color: #fff;
background: url(images/red.png) no-repeat top right;
}
ul.red li a:hover span {
background: url(images/red.png) no-repeat top left;
}
ul.red li a.current {
background: url(images/red.png) no-repeat top right;
color: #fff;
}
ul.red li a.current span {
background: url(images/red.png) no-repeat top left;
}
HTML代码
<h2>四款CSS滑动门效果的水平菜单</h2>
<h2>www.865171.cn</h2>
<ul class="green">
<li><a href="http://www.865171.cn" class="current">
<span></span>home</a></li>
<li><a href="http://www.865171.cn">
<span></span>products</a></li>
<li><a href="http://www.865171.cn">
<span></span>blog</a></li>
<li><a href="http://www.865171.cn">
<span></span>contact</a></li>
</ul>
<ul class="blue">
<li><a href="http://www.865171.cn">
<span></span>home</a></li>
<li><a href="http://www.865171.cn" class="current">
<span></span>products</a></li>
<li><a href="http://www.865171.cn">
<span></span>blog</a></li>
<li><a href="http://www.865171.cn">
<span></span>contact</a></li>
</ul>
<ul class="pink">
<li><a href="http://www.865171.cn">
<span></span>home</a></li>
<li><a href="http://www.865171.cn">
<span></span>products</a></li>
<li><a href="http://www.865171.cn" class="current">
<span></span>blog</a></li>
<li><a href="http://www.865171.cn">
<span></span>contact</a></li>
</ul>
<ul class="red">
<li><a href="http://www.865171.cn">
<span></span>home</a></li>
<li><a href="http://www.865171.cn">
<span></span>products</a></li>
<li><a href="http://www.865171.cn">
<span></span>blog</a></li>
<li><a href="http://www.865171.cn" class="current">
<span></span>contact</a></li>
</ul>