I'm new to css. When I was learning I found something which made me confused.
I know if I not set the height of div,it will decide by what it contains.
Sample code:
div {
border: solid red;
}
div.a {
border: solid green;
height: 10px;
}
<div>
<div class="a">
123<br/>
123<br/>
123<br/>
</div>
</div>
Here Outermost div'height is up-to div.a's height,which is 10px.
But When I set div.a
css as { display: inline-block
;}
div {
border: solid red;
}
div.a {
border: solid green;
height: 10px;
display: inline-block
}
<div>
<div class="a">
123<br/>
123<br/>
123<br/>
</div>
</div>
The height changed. It is up to div.a's content event it is overflow.
What's the display: inline-block
effect.
` or `
` – Felix A J Nov 30 '16 at 09:31