我希望能像照片中一样放置3个div,其中第2个div必须粘着底部
这是我所做的: http://jsfiddle.net/GLHur/1/
我希望能像照片中一样放置3个div,其中第2个div必须粘着底部
这是我所做的: http://jsfiddle.net/GLHur/1/
试试这个:
<div class="con">
<div id="div3"></div>
<div id="div1_2">
<div id="div1"></div>
<div id="div2"></div>
</div>
</div>
#div3{height:100px;width:100px;border: solid 1px #000; display:inline-block; background:red;}
#div1{height:30px;width:100px;border: solid 1px #000; position:absolute; top:0; background:blue;}
#div2{height:20px;width:100px;border: solid 1px #000; position:absolute; bottom:0; background:green;}
#div1_2{display:inline-block; vertical-align:top;}
.con { position:relative; }
这个有效:
#div3{height:100px;width:100px;border: solid 1px #000;
display:inline-block;}
#div1{height:30px;width:100px;border: solid 1px #000;}
#div2{height:20px;width:100px;border: solid 1px #000; position: absolute; bottom: 0}
#div1_2{display:inline-block;vertical-align:top; position: relative; height: 100px;}
<div id="content">
<div id="div3"></div>
<div id="div1"></div>
<div id="div2"></div>
</div>
.
#content { position: relative; height: 100px; width: 220px; }
#div1{ position: absolute; top: 0; right: 0; height:30px; width:100px; background: blue; }
#div2{ position: absolute; bottom:0; right: 0; height:20px; width:100px; background: green; }
#div3{ position: absolute; top: 0; left: 0; height:100px; width:100px; background: red; }
(注:此为IT相关内容)<div style="position: relative;">
<div style="height: 100%;"> </div>
<div style="position: absolute; right: 0px;"> </div>
<div style="position: absolute; right: 0px; bottom: 0px;"> </div>
</div>