關于float和position,還有代碼怎么兼容ie6
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>混合布局</title>
<style type="text/css">
body{padding: 0;margin: 0;font-size: 30px;font-weight: bold;}
div{text-align: center;line-height: 50px;}
.top{height: 100px;background: #ccc;width: 100%;}
.main{height: 600px;background:red;}
.left{height: 600px;width: 200px;background:blue;position:absolute;left: 0;top: 100px;}
.right{height: 600px;background: green;margin-left: 210px;}
.foot{height: 100px;width: 100%;background:purple;clear: both;}
</style>
</head>
<body>
<div class="top">top</div>
<div class="main">
? ? <div class="right">right</div>
? ? <div class="left">left</div>
</div>
<div class="foot">foot</div>
</body>
</html>
我想問下為什么在.lefe這里不能用float:left而只能用position:absolute?float和position到底要在什么時候用?而且有沒有大佬告訴我怎么寫任務四(編寫代碼要兼容IE6)的代碼?
2018-07-24
現在沒有哪個公司開發會兼容ie6了
2018-07-18
兩塊以上如果你只用float而不用絕對定位的話,就會錯位,而代碼要兼容IE6,這點主要是清除浮動有幾種方式,其中一種就是用偽類after,zoom的話需要IE8+才可以