Get two aside sections to float left with fixed width CSS -


i'm trying 2 sections float aside of main column on right side. sections should of fixed width , main should fluid. closest have come. problem main not change size. if 1 aside section had used holy grail, doesn't work either.

[edit]to clarify; html cannot changed (much). left , right need stay after main best screen readers , seo. asides left , right column if content wide enough. specific widths layout trying achieve.[/edit]

http://jsfiddle.net/tr2sd/1/

<div id="container">     <div id="main">         main contents<br>with content     </div>     <aside id="left">         left contents     </aside>     <aside id="right">         right contents     </aside> </div> 

and css:

#container {     border: 1px solid red;     width: 100%; }  #main {     border: 1px dotted #f0f;     margin: 0 -240px 0 0;     position: relative;     width: 100%;     float: left; }  #left {     background-color: #0ff; }  #right {     background-color: #ff0; }  #left,#right {     float: left;     width:220px;     position: relative;     z-index:2; } 

in order locate divs requiring should:

position divs left , right floating right

for div named left placed left of right , must declare right before left , lastly main not require positioned relative container should declare min width prevent break of lay out.

so html should sort of...

<div id="container">      <aside id="right">         right contents     </aside>     <aside id="left">         left contents     </aside>        <div id="main">         main contents<br>with content     </div> </div> 

and css should be

#container {     border: 1px solid red;     width: 100%;      min-width:600px; }  #main {     border: 1px dotted #f0f;     margin: 0 -240px 0 0;     }  #left {      background-color: #0ff; }  #right {      background-color: #ff0; }  #left,#right {     float: right;     width:220px;         } 

from here onwards, adjust fiddle here


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -