还有哪些需要改进的地方

来源:3-1 首页.页面框架代码编写

k1ans

2017-09-16 21:42:52


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>医院挂号平台</title>
    <link href="style.css" rel="stylesheet"  type="text/css">
</head>
<body>    <div  id="top" class="top">
     <div class="warp"></div>
    </div>   
    <div  id="head" class="head">
    </div>
    <div id="nav" class="nav"></div>
    <div id="banner" class="banner">
     <div class="banner-slider"></div>
      <div class="banner-search"></div>
       <div class="banner-help"></div>
    </div>
    <div id="content" class="content clear">    <div class="content-tap"></div>
    <div class="content-news"></div>
     <div class="content-cols"></div>
     </div>
    </div>
    <div id="footer" class="footer"></div>
</body>
</html>

// css样式

body{
margin:0;
padding:0;
}
.clear:after{
 height:0;
 line-height: 0;
 display:block;
    clear:both;
 zoom:1;
}
.worp{
 width:1000px;
 margin:0 auto;
    position:relative;
}
.top{
 height:30px;
 background:#f5f5f5;
}
.head{
 width:1000px;
 height:74px;
 margin:0 auto;

}
.nav{
 height:36px;
 margin:0 auto;
 background:#60bff2;
}
.banner{
 width:802px;
 height:414px;
 margin:0 auto;
 padding:8px 8px 0px 198px;

}
.banner-slider{
 float:left;
 width:544px;
 height:414px;
 background:#8bddf3;
}
.banner-search{
 width:250px;
 height:256px;
 float:right;

    background:#fafafa;
}
.banner-help{
 width:250px;
 height:146px;
    top:12px;
 float:right;
 margin-top:12px;
 background:#fafafa;

}
.content{
 width:1000px;
 margin:0 auto;
 padding:10px 0px 38px 0px;


}
.content-tap{
 width:742px;
    height:490px;
    float:left;
    background:#f4f6fa;
}
.content-cols,
.content-news{
 width:248px;
 height:236px;
 float:right;
 background:yellow;
   
}
.content-cols{
 margin-top:12px;
 background:red;
}
.footer{

 text-align:center;
 line-height:70px;
 height:70px;

 background:#eceef2;
}

为啥清除浮动没有效果


写回答

2回答

小丸子爱吃菜

2017-09-17

给父元素设置高度或者添加overflow:hidden;也是会清除给后面的元素带来的浮动的影响。

0

小丸子爱吃菜

2017-09-17

如果是主体部分的话,直接给主体部分设置overflow:hidden;或者给footer区域设置clear:both;就可以了。

祝学习愉快!

0
h1ans
h 不是给浮动的父元素添加清除嘛
h017-09-17
共1条回复

0 学习 · 36712 问题

查看课程