<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<style type="text/css">
li{list-style: none}
a{text-decoration: none!importantcolor: #fff}
.clearfix:after{
content: ""
display: block
clear: both
}
.clearfix{
zoom:1
}
.nav li {
float: left
width: 150px
background: orange
height: 40px
text-align: center
line-height: 40px
font-family: "微软雅黑"
position: relative
}
.nav > ul > li:hover {
display: inline-block
transition: all 0.5s ease
background: #E9840C
}
.nav .subNav {
position: absolute
right: 0
display: none
}
.nav .subNav li {
background: #217CCB
}
.nav > ul > li:hover .subNav {
display: block
}
</style>
<body>
<div class="nav">
<ul class="clearfix">
<li>
<a href="#">首页</a>
</li>
<li>
<a href="#">组织机构</a>
<div class="subNav">
<ul>
<li><a href="#">信用积分</a></li>
<li><a href="#">实时查询</a></li>
</ul>
</div>
</li>
</ul>
</div>
</body>
</html>
复制到你的html文件里,在浏览器运行看看是不是说的这种纯css实现的显示隐藏的效果。
itjob为您解答:<style>
.it{
list-style:none
}
.it li{
float:none
width:50px
height:30px
position:relative
margin-right:10px
}
.it li ul{
display:none
position:absolute
top:30px
left:0px
}
.it li a{
display:block
text-decoration:none
}
@keyframes itjob{
display:block
}
.it li a:hover ul{
animation:itjob 2s
}
</style>
html:
<div class="div1">
<ul class="it">
<li><a href="#">远标培训1</a></li>
<li>
<a>
<ul>
<li><a href="#">远标培训2</a></li>
</ul>
</a>
</li>
<li><a href="#">远标培训3</a></li>
</ul>
</div>
看你要的效果了,如果要淡入淡出的话,用display设置显示隐藏,在加个transition的过度,要左右滑动显示影藏的话,用transform或者绝对定位显示和隐藏的位子,加transition的过度