I want to have a fluid content-column and a fixed-width sidebar. If browser resizes and content-column gets to small, a media query puts the sidebar below the content.
OK here is what I have @ jsfiddle
… the css:
section { width: 100%; } #wrap { margin: 0 auto; max-width: 600px; width: 100%; } #col1 { float: left; width: 200px; height: 100px; background: lightgreen; } #col2 { width: 100%; height: 100px; background: lightblue; } @media only screen and (max-width: 400px) { #col1 { float: none; width: 100%; } } … html:
<section> <div id="wrap"> <div id="col1"></div> <div id="col2"></div> </div> </section> I know that this is exactly the other way round. I want col2 to have a fixed width and to be on the right side. If I change the float-value to "right", col1 will be on the right side, which is wrong. If I swap all values of #col1 and #col2, col2 will appear below col1 which is also not my intention. I can't use flex box, because of limited browser support.
How can I solve this?
Thx in advance!