css - 3 divs side by side - the center one fixed width and other ones take the rest of the screen space -
i've been trying day long create "container" website. need 3 divs positioned side side. center div has fixed width, 800px , positioned in center of screen, other ones must take remaining space on right , left side. left div somewhere @ top , right 1 @ bottom , use them put there background-image, repeated on x.
i have tried display:table, table-cell, not because when put information in right div (anything else , design move left.
i have implemented code below problem set-up when resize window, right div move on center 1 (i want right , left div resize themselves, not step on center div)
<!doctype html> <html> <head> <meta charset="utf-8"> <title>test</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class = 'left'>1</div> <div class = 'center'>2</div> <div class = 'right'>3</div> </body> </html> css:
.left{ border: 2px solid green; float:left; width:auto; } .center{ border: 2px solid red; position:absolute; width:800px; min-width:800px; left:50%; margin-left: -400px; } .right{ border: 2px solid grey; float:right; position:absolute; right:0; } in jsfiddle: http://jsfiddle.net/ec22y/ how can this? thanks
its possible div follows:
<div class="container"> <div class="left-wrap"> <div class="left-wrap-inner"> <div class="left-div"></div> </div> </div> <div class="right-wrap"> <div class="right-wrap-inner"> <div class="right-div"></div> </div> </div> <div class="central-div"></div> </div> & css
.container{display:block; position:relative;} .left-wrap{display:block; float:left; width:50%;} .left-wrap .left-wrap-inner{display:block; padding:0 400px 0 0;} .left-wrap .left-wrap-inner .left-div{display:block; height:50px; background:#f00;} .right-wrap{display:block; float:right; width:50%;} .right-wrap .right-wrap-inner{display:block; padding:0 0 0 400px;} .right-wrap .right-wrap-inner .right-div{display:block; height:50px; background:#0f0;} .central-div{display:block; width:800px; height:50px; position:absolute; top:0; left:50%; marging:0 0 0 -400px;}
Comments
Post a Comment