My webpage layout consists of a header, footer, and content section. I noticed that when I set the height of the content div to 100%, it overflows instead of expanding accordingly.
I've added some CSS code to style these elements:
* {
margin: 0;
padding: 0;
}
body,
html {
height: 100%;
}
.header,
.footer {
height: 100px;
width: 100%;
background-color: red;
color: white;
}
.content {
width: 100%;
height: 100%;
}
I understand that removing the 100% height resolves the issue, but my question is why does this happen? Shouldn't making the height 100% make it match the parent's height?
If you want to take a look at the full code, check out the JSFiddle link here.