日期:2014-05-17  浏览次数:20761 次

大家帮我看看这个
<!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-Type" content="text/html; charset=utf-8" />
<title>安誉欢迎您</title>
<style type="text/css">
* {
padding:0;
margin:0
}
#top {
width:100%;
height:20px;
border-bottom:solid 1px #D5D5D5;
background:url(img/top.jpg)
}
body {
background-image: url(img/body_bgck.jpg);
background-repeat: repeat-x;
}
/*网站主体*/
#main {
width:910px;
height:1024px;
border:solid 1px #71B8FF;
margin:auto;
}
/* 导航栏*/
#nav {
width:auto;
height:40px;
border: solid 1px #E9FEFC;
margin-top:80px;
}
#nav_left {
width:63px;
height:40px;
margin-left:0px;
margin-top:0px;
float:left;
background:url(img/nav_left.png) left no-repeat;
}
#nav_rigth {
width:63px;
height:40px;
margin-right:0px;
margin-top:0px;
float: right;
background:url(img/nav.png) no-repeat;
}
#nav_content {
width:785px;
height:40px;
margin:auto;
background:url(img/nav_content.png) repeat-x;
clear: none;
}
.nav_ul {
display:block;
width:100%;
height:40px;
margin-top:0;
}
.nav_li {
list-style:none;
float:left;
display: block;
padding:5px;
margin-top: 3px;
margin-right: 20px;
margin-bottom: 3px;
margin-left: 20px;
}

</style>
</head>

<body>
<div id="top"></div>
<div id="main">
  <div id="nav">
  <ul class="nav_ul">
  <div id="nav_left"></div>
  <div id="nav_rigth"></div>
  <div id="nav_content"> </div>
  <li class="nav_li">首页</li>
  <li class="nav_li">等等</li>
  <li class="nav_li">试试</li>
  <li class="nav_li">会员中心</li>
  <li class="nav_li">交流</li>
  <div class="floats"></div>
  </ul>
  </div>
</div>
</body>
</html>

现在是这个文字在导航栏的下面。怎么样进去导航栏里面? 谢谢了


------解决方案--------------------
nav你定的40px的高度,当然都挤没了,你给#nav加个overflow:hidden,毛都剩不下了。
------解决方案--------------------
还有ul里放些独立于li的div干嘛。。 放也就算了,nav_left,nav_right浮动了,nav_contents应该clear掉浮动,否则都nav_contents盖在nav_left和right上了。
------解决方案--------------------
写得不规范。。
------解决方案--------------------
给你个建议 像布局这种东西,尤其是像你这div这么多的情况下
你最好给每个div加上不同的背景颜色或者加上边框颜色;
用来区分你现在要操作的位置,你光这么看看死你;

我敢保证你加上颜色你就知道你错哪了!!