html - align two divs, one at top one at bottom of a third div -
i have code:
<div id="container"> <div id="1"> div 1</div> <div id="2"> div 2</div> </div>
i want put div 1
@ top, , div 2
@ bottom of container
, no matter how height of container
. how can so?
set container's position relative, , position of div's 1 , 2 absolute. set div 1 top:0 , div 2 bottom 0 (also avoid using number id's css compatibility):
#container { position:relative; height:100px; width:100px; border:1px solid #999; } #div1, #div2 { position:absolute; } #div1 { top:0 } #div2 { bottom:0; }
Comments
Post a Comment