Why does the overflow property make a difference in how the elements are laid out in the following sample.
I heard that this happens because when we specify overflow with a value other than visible, it will clear the floats. I am wondering if we can recreate the behavior using clear property (without using overflow).
Another thing I noticed was: if I do not specify overflow for aside, but change its display to inline-block, again, it appears different. What is the difference between display: block and display: inline-block w.r.to previously laid out float elements? does inline-block also clear the floats? thanks.
<html>
<head>
<title>Page Title</title>
<style>
section, aside, footer { border: 1px solid black;}
section {
width: 50%;
height: 50px;
float: left;
}
aside {
width: 30%;
height: 50px;
display: block;
overflow: hidden; /* comment this and see what happens */
}
footer {
width: 10%;
height: 50px;
}
</style>
</head>
<body>
<section>Section 1</section>
<aside>Aside</aside>
<footer>Footer</footer>
</body>
</html>