css自適應

來源:互聯網
上載者:User

標籤:plain   border   archive   它的   nbsp   flow   margin   static   lin   

//寬度

<div style="border:1px solid red">
  <div style="float: left;background:#00f;width:100px;_margin-right:-3px">ggds</div>
  <div style="float: right;background:red;width:100px;_margin-left:-3px">ggds</div>
  <div style="margin:0 100px;background:#0f0">ggds</div>
</div>

//高度

<div style="height:70px">ggds</div>
<div style="border:1px solid red;position:absolute;top:70px;bottom:0;width:100%"></div>

//IE6

html{padding-top:70px}
<div style="background:red;position:absolute;top:0;width:100%;height:70px">ggds</div>
<div style="border:1px solid red;height:100%"></div>

//最終

html,body{ height:100%;}

body,div{ margin:0; padding:0; color:#F00;} * html{ padding-top:100px;}/*for ie6*/ .top{ background:#36C; height:100px;} * html .top{ background:#36C; height:100px; position:absolute; top:0; width:100%;}/*for ie6*/ .main{ background:#F90; position:absolute; width:100%; top:100px; bottom:0; overflow:auto;} * html .main{ background:#F90; position:static; height:100%;}/*for ie6*/ <div class="top">ggds</div>
<div class="main"></div> //等高布局

.contain{
  margin:0 auto;
  width:600px;
  border:3px solid #00C;
  overflow:hidden; /*這個超出隱藏的聲明在IE6裡不寫也是可以的*/
}
.left{
  float:left;
  width:144px;
  background:#B0B0B0;
  padding-bottom:2000px;
  margin-bottom:-2000px;
}
.right{
  float:left;
  width:450px;
  background:#6CC;
  padding-bottom:2000px;
  margin-bottom:-2000px;
}

<div class="contain">
  <div class="left">我是left</div>
  <div class="right">我是right<br><br><br>現在我的高度比left高,但left用它的padding-bottom補償了這部分高度</div>
  <div style="clear:both"></div>
</div>

 

相關文章:http://www.cnblogs.com/2050/archive/2012/07/30/2614852.html

    http://www.cnblogs.com/2050/archive/2012/07/30/2615260.html

    http://www.cnblogs.com/2050/archive/2012/07/31/2616460.html

 

 

 

 

 

 

 

 

 

 

 

css自適應

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.