编写导航栏(无需写js代码)


<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>jquery编写导航栏</title>
	<style type="text/css">
		#navigation{
		    width:1180px;
		    padding:8px;
		    margin:5px auto;
		    background:#3b5998;
		    height:16px;
		    font-size:14px;
		}
		#navigation ul{
		    margin-top: 0;
		    list-style-type:none;
		}
		#navigation ul li{
		    float:left;
		    margin-right:14px;
		    position:relative;
		    z-index: 100;
		}
		#navigation ul li a{
		    padding:0 8px;
		    font-weight:700;
		    color:#FFFFFF;
		    text-decoration: none;
		}
		#navigation ul li ul{
		    background:#88c366;
		    position:absolute;
		    overflow:hidden;
		    display:none;
		    padding-left:0;
		    list-style-type:none;
		}
		#navigation ul li:hover ul{
		    background:#88c366;
		    position:absolute;
		    width:100px;
		    display:block;
		    padding-left:0;
		}
		#navigation ul li ul li{
		    border-bottom: 1px solid #bbb;
		    text-align:left;
		    width:100%;
		}
		#navigation ul li ul li:hover{
		    background:#3b5998;
		}
	</style>
</head>
<body>
    <div id="navigation">
    	<ul>
    		<li>
    			<a href="#">首页</a>
    		</li>
    		<li>
    			<a href="#">衬衫</a>
    			<ul>
    				<li>
    					<a href="#">短袖衬衫</a>
    				</li>
    				<li>
    					<a href="#">长袖衬衫</a>
    				</li>
    				<li>
    					<a href="#">无袖衬衫</a>
    				</li>
    			</ul>
    		</li>
    		<li>
    			<a href="#">卫衣</a>
    			<ul>
    				<li>
    					<a href="">开襟卫衣</a>
    				</li>
    				<li>
    					<a href="">套头卫衣</a>
    				</li>
    			</ul>
    		</li>
    		<li>
    			<a href="#">裤子</a>
    			<ul>
    				<li>
    					<a href="#">休闲裤</a>
    				</li>
    				<li>
    					<a href="#">卡其裤</a>
    				</li>
    				<li>
    					<a href="#">牛仔裤</a>
    				</li>
    				<li>
    					<a href="#">短裤</a>
    				</li>
    			</ul>
    		</li>
    		<li>
    			<a href="#">联系我们</a>
    		</li>
    	</ul>
    </div>
</body>
</html>

展开阅读全文

没有更多推荐了,返回首页