div+css排版控制

來源:互聯網
上載者:User

 

<div style="position:relative; width:100%; height:100%; top:0px; left:0px; margin:0px; padding:0px; background-color:red; ">

    <div style="position:absolute; width:30%; height:100%; top:0px; left:0px; margin:0px; padding:0px; background-color:green; "></div>

    <div style="position:absolute; width:70%; height:100%; top:0px; left:30%; margin:0px; padding:0px; background-color:green; "></div>

</div>

 

position    定位方式,根容器使用relative,其他的使用absolute

width,height    大小推薦使用百分比

top,left,bottom,right 定位推薦使用百分比

margin,padding    內外補丁推薦使用像素為單位

background-color    背景色,看布局效果

相關文章

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.