I working on a website that has 2 elements side by side inside of a parent element (I'm using float:left
and float:right
to control their positioning), but the parent element won't show up unless I set it to position:absolute
. I can't do that because I am making a footer at the bottom of the website, and the parent element will be at a variable height.
HTML
<div id="wrapper">
<div id="div1">div 1</div>
<div id="div2">div 2</div>
</div>
<div class="clear"></div>
<div id="footer">this is a footer</div>
CSS:
#wrapper {
background:blue;
/* setting to position:absolute will make blue bg show up,
but footer disappear */
position:relative;
width:150px;
}
.clear {
clear:both;
}
#div1 {
float:left;
display:inline;
padding:20px;
}
#div2 {
float:right;
display:inline;
padding:20px;
}
Am I missing something??