luyuni
2018-03-17 16:40
index代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/main.css" type="text/css"/>
<script type="text/javascript" src="js/setHomeSetFav.js" ></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 end-->
<div class="warp">
<div class="logo">
<div class="logo_left"><img src="img/logo.jpg" alt="慕课网"></div>
<div class="logo_right"><img src="img/tel.jpg" alt="服务热线">24小时服务热线:<span class="tel">123-456-7890</span></div>
</div><!--logo end-->
<div class="nav">
<div class="nav_left"></div>
<div class="nav_middle">
<div class="nav_middle_left">
<ul>
<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_middle_right">
<form action="#" method="post">
<input type="text" name="serch"/>
</form>
</div>
</div><!--nav_middle end-->
<div class="nav_right"></div>
</div><!--nav end-->
</div><!--warp end-->
</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: 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: #900;
text-decoration: none;
}
.warp{
width: 1000px;
margin: 0 auto;
}
.logo{
height: 80px;
background-color: #fff;
}
.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: #c00;
}
.nav{
height: 40px;
}
.nav_left{
width: 10px;
background: url(../img/nav_left.jpg) no-repeat;
}
.nav_middle{
width: 980px;
background: url(../img/nav_bg.jpg) repeat-x;
}
.nav_right{
width: 10px;
background: url(../img/nav_right.jpg) no-repeat;
}
.nav_left, .nav_middle, .nav_right{
float: left;
height: 40px;
}
我刚刚也是,然后在nav标签中清除浮动clear:both;
明明是nav_left没有加float,最佳答案什么鬼
为什么视频老师的代码不会这样呢?
我也是这个问题,加上清楚浮动之后就好了,但是我代码都是照着老师打的,为什么老师不需要加上清楚浮动的语句就可以实现正确的效果呢?
谢谢!
谢谢大佬,终于解决了
企业网站综合布局实战
157038 学习 · 2018 问题
相似问题
回答 3
回答 3