I am a newbie to CSS and I stumbled on something strange.
Looking at the code below, changing the height to 0% shrinks the background colour to the text but does not collapse it the way width 0% does. Any explanations?
div {
margin: 10px;
font-size: 200%;
color: white;
height: 0%;
width: 100%;
border: 2px solid black;
}
div:nth-child(1) {
background-color: red;
}
div:nth-child(2) {
background-color: blue;
}
<div>I am the next div element</div>
<div>I am the next div element</div>