css div 定位

來源:互聯網
上載者:User

用css來控制div 的定義方法很多,下面我們就來看看不同方法的執行個體代碼吧.

 代碼如下 複製代碼

<div style="width:150px;height:150px;background:#FF0000;position:relative">
<div style="width:100px;height:50px;background:#006633;position:absolute;right:0;bottom:0"></div>
</div>

<div style="width:150px;height:150px;background:#FF0000;padding-bottom:0px;position:relative;">
<div style="width:100px;height:50px;background:#006633;margin-bottom:0px;position:absolute;bottom:0;"></div>
</div>

<div style="width:550px;height:150px;background:#FF0000;">
 <div style="width:100%;height:100%;"></div>
 <div style="width:100px;height:50px;background:#006633;margin-top:-50px;float:left">的撒旦撒<Br><Br><Br><Br><Br><Br><Br><Br><Br></div>
 <div style="width:100px;height:50px;background:#006633;margin-top:-50px;float:left"><Br></div>
</div>

<div style="width:150px;height:150px;background:#FF0000;">
 <div style="width:100%;height:100%;"></div>
 <div style="width:100px;height:50px;background:#006633;margin-top:-50px"></div>
</div>

 好了有四種方法,但是都大同小義了,

相關文章

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.