I was going through this doc about containing blocks. Note the Example 2 here.
HTML:
<body>
<section>
<p>This is a paragraph!</p>
</section>
</body>
CSS:
body {
background: beige;
}
section {
display: inline;
background: lightgray;
}
p {
width: 50%; /* == half the body's width */
height: 200px; /* Note: a percentage would be 0 */
background: cyan;
}
In the CSS inline comment, it states that a percentage would be 0. Why is this the case?
My understanding has been that a block element's height would be the height of its content unless explicitly set. Can someone clarify why a percentage of the height would be zero and also, if my understanding is wrong?