Web Development
<section id="section1"></section>
<section id="section2">Content outside section</section>
CSS
section{
width : 100px;
height : 100px;
}
#section1{
background-color : lightgreen;
float : left;
}
#section2{
background-color : green;
}
I have two <sections>
with specific dimensions. One is set to float:left
and the other isn't. Both appear at the same location on the page. However, the text inside the second <section>
spills outside its boundary. Why is that?
When I add overflow:auto
to #section2
, the second <section>
is displayed in a new position beside the first one. This behavior confuses me.