标签:padding 底部 pad isp hit absolute pre color osi
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <link rel="stylesheet" type="text/css" href="css/main.css"> 6 </head> 7 <body> 8 <div id="header">头部</div> 9 <div id="container"> 10 <div class="mainBox"> 11 内容区域 12 <p>我说情爱的请大赛撒谎和大嫂多少</p> 13 <p>hsdaufhsalfsa</p> 14 <p>shhsaldhsakl</p> 15 <p>我说情爱的请大赛撒谎和大嫂多少</p> 16 <p>hsdaufhsalfsa</p> 17 <p>shhsaldhsakl</p> 18 <p>我说情爱的请大赛撒谎和大嫂多少</p> 19 <p>hsdaufhsalfsa</p> 20 <p>shhsaldhsakl</p> 21 <p>我说情爱的请大赛撒谎和大嫂多少</p> 22 <p>hsdaufhsalfsa</p> 23 <p>shhsaldhsakl</p> 24 <p>我说情爱的请大赛撒谎和大嫂多少</p> 25 <p>hsdaufhsalfsa</p> 26 </div> 27 <div class="sideBox"> 28 侧边栏 29 <span>把手</span> 30 </div> 31 </div> 32 <div id="footer">底部</div> 33 </body> 34 </html>
1 body{ 2 padding: 0px; 3 margin: 0px; 4 } 5 6 #header,#footer{ 7 height: 50px; 8 background-color: #e9e9e9; 9 10 } 11 12 #container{ 13 position: relative; 14 overflow: hidden; 15 margin: 10px 0px; 16 } 17 18 #container:after{ 19 display: block; 20 content: ""; 21 line-height: 0px; 22 font-size: 0px; 23 clear: both; 24 visibility: hidden; 25 } 26 27 .mainBox{ 28 margin-left: 320px; 29 background-color: green; 30 width: auto; 31 color: white; 32 } 33 34 .sideBox{ 35 width: 300px; 36 height: 500px; 37 position: absolute; 38 left: 0px; 39 top: 0px; 40 background: #234567; 41 } 42 43 .sideBox span{ 44 background: red; 45 color: white; 46 right: 0px; 47 position: absolute; 48 top: 50%; 49 width: 30px; 50 height: 50px; 51 text-align: center; 52 }
要想两列等高一般采用js进行计算设置,如果采用css则可以使用背景填充办法,或者背景色填充办法,但都不是太好
标签:padding 底部 pad isp hit absolute pre color osi
原文地址:http://www.cnblogs.com/rjjs/p/6498575.html