纯CSS制作简洁的垂直导航
文章来自:互联网 | 发表时间:2007-9-20 23:11:23
以下是引用片段:
/* common styling */
/* set up the overall width of the menu div, the font and the margins */
.menu {#FF0000;">
font-family: arial, sans-serif;#FF0000;">
width:750px;#FF0000;">
margin:0;#FF0000;">
margin:50px 0;
}
/* remove the bullets and set the margin and padding to zero for the unordered list */
.menu ul {#FF0000;">
padding:0;#FF0000;">
margin:0;#FF0000;">
list-style-type: none;
}
/* 浮动列表,因此可以让items在一行上,并且他们的相对定位可以让下面的列表显示在正确的位置上*/
.menu ul li {#FF0000;">
float:left;#FF0000;">
position:relative;
}
/* style the links to be 104px wide by 30px high with a top and right border 1px solid white.
Set the background color and the font size. */
.menu ul li a, .menu ul li a:visited {#FF0000;">
display:block;#FF0000;">
text-align:center;#FF0000;">
text-decoration:none;#FF0000;">
width:104px;#FF0000;">
height:30px;#FF0000;">
color:#000;#FF0000;">
border:1px solid #fff;#FF0000;">
border-width:1px 1px 0 0;#FF0000;">
background:#c9c9a7;#FF0000;">
line-height:30px;#FF0000;">
font-size:11px;
}
/* make the dropdown ul invisible */
.menu ul li ul {#FF0000;">
display: none;
}
/* specific to non IE browsers */
/* set the background and foreground color of the main menu li on hover */
.menu ul li:hover a {#FF0000;">
color:#fff;#FF0000;">
background:#b3ab79;
}
/* make the sub menu ul visible and position it beneath the main menu list item */
.menu ul li:hover ul {#FF0000;">
display:block;#FF0000;">
position:absolute;#FF0000;">
top:31px;#FF0000;">
left:0;#FF0000;">
width:105px;
}
/* style the background and foreground color of the submenu links */
.menu ul li:hover ul li a {#FF0000;">
display:block;#FF0000;">
background:#faeec7;#FF0000;">
color:#000;
}
/* style the background and forground colors of the links on hover */
.menu ul li:hover ul li a:hover {#FF0000;">
background:#dfc184;#FF0000;">
color:#000;
}