詳解css響應式布局相容ie6的方法代碼

來源:互聯網
上載者:User
1、兩欄布局 左側定寬 右側自適應

<div class="grid1">    <div class="left_1">左側定寬</div>    <div class="right_1">右側自適應</div></div>


.left_1{float:left; width:200px;}.right_1{margin-left:200px;}

2、兩欄布局 左側自適應 右側定寬

<div class="grid2 clearfix">    <div class="left_2">左側自適應</div>    <div class="right_2">右側定寬</div></div>
.left_2{float:left; width:100%; margin-right:-200px;}.right_2{float:right; width:200px;}

3、三欄布局 兩側定寬 中間自適應

<div class="grid3 clearfix">    <div class="left_3">左側定寬</div>    <div class="center_3">中間自適應</div>    <div class="right_3">右側定寬</div></div>
.left_3, .right_3{position:relative; float:left; width:200px;}.left_3{margin-right:-200px;}.right_3{margin-left:-200px;}.center_3{float:left; width:100%;}

4、三欄布局 左側自適應 中間和右側定寬

<div class="grid4 clearfix">    <div class="left_4">左側自適應</div>    <div class="center_4">中間定寬</div>    <div class="right_4">右側定寬</div></div>
.center_4, .right_4{position:relative; float:right; width:200px;}.left_4{float:left; width:100%; margin-right:-400px;}

5、三欄布局 左側和中間定寬 右側自適應

<div class="grid5">    <div class="left_5">左側定寬</div>    <div class="center_5">中間定寬</div>    <div class="right_5">右側自適應</div></div>
.left_5, .center_5{position:relative; float:left;width:200px;}.right_5{margin-left:400px;}

以上寫法可相容5大瀏覽器,及IE6到IE8瀏覽器

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.