下面是我刚自己写的一个导航
HTML code
<link rel="stylesheet" type="text/css" href="导航.css" /></head><body><div id="header"><h1><a href="http://www.xnxyw.net"><b>湘南在线</b>www.xnxyw.net</a></h1><div id="menu"><h2><a href="#">首页</a></h2><h2><a href="http://www.xnu.edu.cn">学院首页</a></h2><h2><a href="http://www.xnxyw.net">贴吧</a></h2></div></div></body></html>
CSS code
#header{width:960px;margin-top:80px;margin-left:auto;margin-right:auto;background-color:#00CEDE;height:40px;}h1{width:600px;float:left;font-size:9px;}#header a{color:#666;margin-top:5px;margin-left:10px;text-decoration:none;float:left;}#header a:hover{text-decoration:underline;}b{font-weight:bolder;font-size:16px;}#menu{width:360px;float:right;}#menu h2{width:120px;text-align:center;font-size:16px;}#menu a{width:119px;color:#666;display:block;float:left;text-decoration:none;}#menu a:hover{background-color:#E0FFFF;text-decoration:none;}
我已经设置了<a>的 display属性为block,但是为什么不是横向排列呢?
------解决方案--------------------
h2{float:left;}
------解决方案--------------------
怎么不用ul li呢。这个方便多咯额