having given the html
and body
elements a height: 100%
height,
and also having given a child element of body, say, main
a height: 100%
height,
it refuses to take the height.
but if a child element of main
is given a height: 50%
height, it will work given main
has a set height.
Why does this work for here and not for the latter?
Edit*
here's a working code
html,
body {
height: 100%;
}
main {
height: 100%;
background: red;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Height</title>
</head>
<body>
<main> </main>
</body>
</html>