为什么不定义nav的样式 会出现“首页”右侧浮动的现象
html代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="../css/main.css" type="text/css">
<script src="../js/jquery-1.4.4.min.js" charset="gb2312"></script>
<script src="../js/setHomeSetFav.js" charset="gb2312"></script>
<script src="../js/myfocus-2.0.1.min.js" charset="gb2312"></script>
</head>
<body>
<div class="top">
<div class="top_content">
<ul>
<li><a href="#">联系我们</a></li>
<li><a href="#" onclick="AddFavorite(window.location,Document.title)">加入收藏</a></li>
<li><a href="#" onclick="SetHome(window.location)">设为首页</a></li>
</ul>
</div>
</div>
<!--top结束-->
<div class="wrap">
<div class="logo">
<div class="logo_left">
<img src="./../img/logo.jpg" alt="慕课网">
</div>
<div class="logo_right">
<img src="./../img/tel.jpg" alt="服务热线">
小时服务热线:<span class="tel">177-5296-1997</span>
</div>
</div>
<!--logo结束-->
<div class="nav">
<div class="nav_leif"></div>
<div class="nav_mid">
<div class="nav_mid_left">
<ul>
<li><a href="#">首页</a></li>
<li><a href="list.html">关于慕课</a></li>
<li><a href="list.html">新闻动态</a></li>
<li><a href="list.html">课程中心</a></li>
<li><a href="list.html">在线课程</a></li>
<li><a href="list.html">人才招聘</a></li>
</ul>
</div>
<div class="nav_mid-right">
<form action="" method="POST">
<input type="text">
</form>
</div>
</div>
<div class="nav_right"></div>
</div>
<!-- nav结束 -->
</div>
<!-- wrap结束 -->
</body>
</html>
css代码:
* {
margin: 0;
padding: 0;
font-size: 12px;
}
body{
background-color: #F5F5F5;
}
.top{
width: 100%;
height: 27px;
background: url(../img/top_bg.jpg) repeat-x;
}
.top_content{
width: 1000px;
margin: 0 auto;
}
.top_content li{
list-style-image: url(../img/li_bg.gif);
float: right;
width: 70px;
line-height: 27px;
}
.top_content a:link,.top_content a:visited{
color: #8e8e8e;
text-decoration: none;
}
.top_content a:hover,.top_content a:active{
color: red;
text-decoration: none;
/* text-decoration--文本下划线 */
/* active--活动状态 */
}
.wrap{
width: 1000px;
margin: 0 auto;
}
.logo{
height: 80px;
background-color:white;
}
.logo_left{
width: 200px;
float: left;
}
.logo_right{
width: 300px;
float: right;
height: 28px;
margin-top: 30px;
color: #8e8e8e;
}
.logo_right img{
vertical-align: middle;
/* 垂直对齐图像 :中间*/
margin-right: 10px;
}
.tel{
font-family: 微软雅黑;
font-size: 16px;
color: rgb(204, 5, 5);
}