现在的下拉菜单是兼容性越来越好了,不用js的最好了,但如果能用最少的代码实现出效果,也是不错的
第一个,用到的js,不过很短,也很明了
*{font:normal normal 14px/1.5em "宋体";}
li{list-style:none;}
span{display:block;line-height:25px;}
a{text-decoration:none;display:block;margin:5px;}
.class1{
width:100px;
height:25px;
overflow-y:hidden;
border:1px solid #ffe663;
text-align:center;
background:#fff2d9;
}
.class2{
width:100px;
height:135px;
overflow-y:hidden;
border:1px solid #ffe663;
text-align:center;
background:#fff2d9;
}
a:hover{
border:1px dashed red;
}
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]
这一个也不错
.menu {
font-size: 0.85em; width: 750px; font-family: verdana, sans-serif; position: relative
}
.menu ul {
padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px; list-style-type: none
}
.menu ul li {
float: left; position: relative
}
.menu ul li a {
border-right: #fff 1px solid; border-top: #fff 1px solid; display: block; padding-left: 10px; background: #dfc184; border-left: #fff 0px solid; width: 139px; color: #000; line-height: 3em; border-bottom: #fff 0px solid; height: 3em; text-decoration: none
}
.menu ul li a:visited {
border-right: #fff 1px solid; border-top: #fff 1px solid; display: block; padding-left: 10px; background: #dfc184; border-left: #fff 0px solid; width: 139px; color: #000; line-height: 3em; border-bottom: #fff 0px solid; height: 3em; text-decoration: none
}
* html .menu ul li a {
width: 139px
}
.menu ul li a:visited {
width: 139px
}
.menu ul li ul {
display: none
}
table {
font-size: 1em; margin: -1px; border-collapse: collapse
}
.menu ul li:hover a {
background: #bd8d5e; color: #fff
}
.menu ul li:hover ul {
margin-top: 1px; display: block; left: 0px; width: 150px; position: absolute; top: 3em
}
.menu ul li:hover ul li ul {
display: none
}
.menu ul li:hover ul li a {
padding-right: 10px; display: block; padding-left: 10px; background: #faeec7; padding-bottom: 5px; width: 129px; color: #000; line-height: 1.2em; padding-top: 5px; height: auto
}
.menu ul li:hover ul li a.drop {
background: url(drop.png) #c9c9a7 no-repeat right bottom
}
.menu ul li:hover ul li a:hover {
background: #c9c9a7; color: #000
}
.menu ul li:hover ul li:hover ul {
display: block; left: 150px; width: 150px; position: absolute; top: 0px
}
.menu ul li:hover ul li:hover ul.left {
left: -150px
}
- demos<!--
- zero
dollars advertising page - wrapping text
around images - styled form
- active
focus - hover/click
with no borders<!--- styled
form - removing
active/focus borders - hover/click
- styled
- shadow
boxing - image map
for detailed information
- zero
- boxes
--> <!--- a coded
list of spies
- a coded
- mozilla
- drop down
menu - cascading
menu - content:
- i can
build a rainbow with transparent borders - a snooker
cue using border art - target
practise - two tone
headings - shadow
text
- drop down
- explorer<!--
- the first
example for internet explorer - weft fonts
- vertically
aligning text
- the first
- opacity
- partial
opacity ii - hover/click
- styled
form - removing
active/focus borders - hover/click
- styled
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]
http://www.jluvip.com/works/css/dropmenu/dropmenu.html