The question seems simple enough. Like a good little nerd I've done my research. Everything that I've found says that for something to have height: 100%
every nested parent element must have a height for the child div to fill up. And that's exactly what I have.
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
<body>
<div id="content"></div>
</body>
</html>
That's literally all my HTML. I JUST started this project, which is part of the reason I'm so bewildered. My CSS looks like this:
html, body {
padding: 0;
margin: 0;
}
html {
height: 100%;
}
body {
min-height: 100%;
}
#content {
width: 100%;
height: 100%;
background-color: lightcoral;
}
That's it. That's all my code. The background color of #content
is exclusively so I can see the space it takes up. If I add text in the div or change its height to a pixel value in the CSS, the color shows up. If I switch it back to this, it disappears. Additionally, I'm working in Chrome and when I mouse over source in the Elements tab of the dev tools, both html
and body
are very clearly the height of the window. When I mouse over the #content
div, I can see the style in the dev tools where it says height: 100%
, but the height is 0px. I'm beyond perplexed. Any ideas?