I want to achieve the following: A design with two columns of the same width, covering the whole width of the document, or a fixed width of pixels, whichever is smaller. When they are resized to a certain width, they should be moved underneath each other and take up at most 100% of the width of the screen (exactly 100% would be nice, but is not necessary).
I came up with the following code, but the max-width
of 100% does not get applied.
Can i combine a width in percent and a max-width in percent like this?
Is this possible without another layer of divs?
Is this possible at all?
#head {
background-color: #00FF00;
}
body {
text-align: center;
}
#container {
margin: 0 auto;
width: 100%;
max-width: 500px;
text-align: center;
}
#left {
background-color: #FF0000;
float: left;
width: 50%;
min-width: 150px;
max-width: 100%;
}
#right {
background-color: #0000FF;
float: left;
width: 50%;
min-width: 150px;
max-width: 100%;
}
<div id="head">
foo
</div>
<div id="container">
<div id="left">
bar
</div>
<div id="right">
baz
</div>
</div>