The div#inner1
and div#inner2
are inside the div#outer
, but still the height of div#outer
shows as 0px with height:auto
.
How do I get the height of the child elements for the outer div?
This is my code:
#outer {
width: 300px;
height: auto;
background: #ccc;
}
#inner1 {
float: left;
width: 100px;
height: 100px;
background: #f00;
}
#inner2 {
float: left;
width: 100px;
height: 100px;
background: #0f0;
}
<div id="outer">
<div id="inner1"></div>
<div id="inner2"></div>
</div>