纯CSS下拉导航菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS菜单--下拉菜单</title>
<style>
/*Author:5key.net*/
body{
background-color:white;
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
margin:0px;
padding:0px;
color:white;
}
ul,li{
margin:0px;
padding:0px;
}
li{
display:inline;
list-style:none;
list-style-position:outside;
text-align:center;
font-weight:bold;
float:left;
}
a:link{
color:#336601;
text-decoration:none;
float:left;
width:100px;
padding:3px 5px 0px 5px;
}
a:visited{
color:#336601;
text-decoration:none;
float:left;
padding:3px 5px 0px 5px;
width:100px;
}
a:hover{
color:white;
float:left;
padding:3px 3px 0px 20px;
width:88px;
text-decoration:none;
background-color:#539D26;
}
a:active{
color:white;
float:left;
padding:3px 3px 0px 20px;
width:88px;
text-decoration:none;
background-color:#BD06B4;
}
#nav{
    width:600px;
    height:30px;
    border-bottom:0px;
    padding:0px 5px;
    position:absolute;
    z-index:1;
    left: 198px;
    top: 25px;
}
.list{
line-height:20px;
text-align:left;
padding:4px;
font-weight:normal;
}
.menu1{
width:120px;
height:auto;
margin:6px 4px 0px 0px;
border:1px solid #9CDD75;
background-color:#F1FBEC;
color:#336601;
padding:6px 0px 0px 0px;
cursor:hand;
overflow-y:hidden;
filter:Alpha(opacity=70);
-moz-opacity:0.7;
}
.menu2{
width:120px;
height:18px;
margin:6px 4px 0px 0px;
background-color:#F5F5F5;
color:#999999;
border:1px solid #EEE8DD;
padding:6px 0px 0px 0px;
overflow-y:hidden;
cursor:hand;
}
</style>
</head>

<body>
<div id="nav">
    <ul>
    <li class="menu2" onMouseOver="this.className=‘menu1‘" onMouseOut="this.className=‘menu2‘">我的首页
    <div class="list">
        <a href="#">我的CHINAY</a><br />
        <a href="#">我的首页</a><br />
        <a href="#">我的日志</a><br />
        <a href="#">我的日志</a><br />
        <a href="#">我的相册</a><br />
        <a href="#">我的收藏</a><br />
    </div>
    </li>
    <li class="menu2" onMouseOver="this.className=‘menu1‘" onMouseOut="this.className=‘menu2‘">社区圈子
    <div class="list">
        <a href="#">我的CHINAY</a><br />
        <a href="#">我的首页</a><br />
        <a href="#">我的日志</a><br />
        <a href="#">我的相册</a><br />
        <a href="#">我的收藏</a><br />
    </div>
    </li>
    <li class="menu2" onMouseOver="this.className=‘menu1‘" onMouseOut="this.className=‘menu2‘">我的短信
    <div class="list">
        <a href="#">我的CHINAY</a><br />
        <a href="#">我的相册</a><br />
        <a href="#">我的收藏</a><br />
    </div>
    </li>
    <li class="menu2" onMouseOver="this.className=‘menu1‘" onMouseOut="this.className=‘menu2‘">账户管理
    <div class="list">
        <a href="#">我的CHINAY</a><br />
        <a href="#">我的首页</a><br />
        <a href="#">我的日志</a><br />
        <a href="#">我的相册</a><br />
        <a href="#">我的收藏</a><br />
        <a href="#">我的日志</a><br />
        <a href="#">我的相册</a><br />
        <a href="#">我的收藏</a><br />
    </div>
    </li>
    </ul>
</div>
</body>
</html>
时间: 2024-08-04 17:09:50

纯CSS下拉导航菜单的相关文章

38 个免费开源的 CSS 下拉导航菜单

http://www.oschina.net/news/51624/38-open-source-css-dropdown-menus38 个免费开源的 CSS 下拉导航菜单,布布扣,bubuko.com

基于div css下拉导航菜单分类代码

基于div css下拉导航菜单分类代码是一款绿色风格的jQuery下拉分类导航菜单.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="hc_lnav jslist"> <div class="allbtn"> <h2><a href="#"><strong> </strong>全部商品分类<i> </i><

纯CSS下拉导航和jquery下拉导航对比

纯css实现的下拉导航demo:http://codepen.io/tianzi77/pen/xGOyxp 不用javascript以及jquery动态效果实现导航条的下拉效果.纯css属性实现,主要应用到绝对定位中的left:auto和left:-9999px:来隐藏或者鼠标经过的时候显示下拉菜单. htm结构: <ul class="nav"> <li><a href="/">小哲</a></li> &

纯CSS实现的二级下拉导航菜单实例代码

纯CSS实现的二级下拉导航菜单实例代码:二级下拉菜单在众多的网站都有应用,不但能够有效的组织分类导航,并且能够节省大量的网站空间,也能够实现网站的动态化效果,大多数二级导航菜单都是结合javascript实现,本章节介绍一下使用纯css实现的下拉菜单.代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" co

支持多种浏览器的纯css下拉菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312

CSS+JS下拉菜单和纯CSS下拉菜单

一.CSS+JS下拉菜单 原理:一级菜单的li中包含二级菜单ul.在鼠标没有移上去时,二级菜单的ul是display:none的状态,鼠标一移上去变成display:block.改变这个display属性值是通过JS来实现.鼠标hover时,把整个二级菜单的ul给display出来,用到的事件onmouseonver.鼠标移出又把整个二级菜单的ul 给隐藏掉. nav-js.html文件 <!DOCTYPE html > <html> <head> <meta c

纯CSS下拉菜单代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

jquery实现的点击二级下拉导航菜单

jquery实现的点击二级下拉导航菜单:二级下拉导航菜单是各种类型的网站都有使用,所以是一个必须掌握的技能,对于老手来说肯定是轻松加愉快,但是对于初学者来说未必如此,下面就通过代码实例详细介绍一下点击二级下拉菜单实现过程.代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="htt

使用checkbox实现纯CSS下拉框

今天给大家讲一个css例子,主要内容是使用checkbox实现纯css下拉框,要用到了HTML元素的checkbox 和CSS3选择器(http://www.maiziedu.com/course/web/228-2627/),并没有用到JavaScript.例子如下: 实现过程: HTML结构 <div class="dropdown"> <input type="checkbox" id="checkbox_toggle"&