html - set DIV alignment to bottom -
how can make div left3 bottom , left4 bottom align bottom (like left2 bottom) , stretch left2 top div on full width?
i tried vertical-align: bottom; not help.
cheers, pete
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test</title> <style type="text/css"> .wrapper{ margin: 0px auto; width: 940px; background-color: #28cf21; } .header{ width: 100%; background-color: #12bf81; } .left1{ float: left; margin-right: 20px; width: 220px; height: 500px; background-color: #fc0234; } .left2{ float: left; margin-right: 20px; width: 220px; height: 500px; background-color: #f78325; } .left2oben{ float: left; margin-right: 20px; width: 220px; height: 250px; background-color: #f78325; } .left2unten{ float: left; margin-right: 20px; width: 220px; height: 250px; background-color: #f11325; } .left3{ float: left; margin-right: 20px; width: 220px; height: 250px; background-color: #f78325; } .left4{ float: left; width: 220px; height: 250px; background-color: #f78325; } body { padding: 0px; margin: 0px; font-size: 90%; background-color: #00ccff; } </style> </head> <body> <div class="wrapper"> <div class="header"> header </div> <div class="left1"> left1 </div> <div class="left2"> <div class="left2oben"> left2 top </div> <div class="left2unten"> left2 bottom </div> </div> <div class="left3"> left3 bottom </div> <div class="left4"> left4 bottom </div> </div> </body> </html>
have tried using "bottom" in css?
.left3{ float: left; margin-right: 20px; width: 220px; height: 250px; background-color: #f78325; position: absolute; bottom:0; } .wrapper{ margin: 0px auto; width: 940px; background-color: #28cf21 position:relative; } when both .left3 , .left4 set float:left there issue of 2 overlapping. can use different float settings, or use left or right in css used bottom.
explanation
in css, set bottom 0 .left3 , .left4, means 2 divs, 0 pixels bottom. same can used top, right left. position must set absolute, in order feature work.
also, idea habit of putting semi-colon @ end of every statement in css, regardless if ending statement in brackets.
update set position wrap div relative, position inner div absolute. positioning means contents can overlap each other, must maintain fixed heights content
Comments
Post a Comment