As a newbie to HTML/CSS, I'm struggling with implementing what I described in the title. It was functioning properly earlier, but now it seems like I made a mistake somewhere and it's no longer working.
My code is quite lengthy, but the remaining part is commented out so it doesn't affect anything.
body {
background-color: red;
margin: 0em;
}
#main {
background-color: #E3E3E3;
width: 75%;
margin: auto;
height: 100%;
}
<html>
<head>
</head>
<body>
<div id="main">
</div>
</body>
<html>
Shouldn't that code create what I want? Setting the height to em/px works fine, but not on percentages, even though they work for the width.
I've set the background color to red for easy differentiation, by the way.
What am I missing here?