I have the following html / css code:
.first,
.second {
width: 200px;
height: 100px;
border: 1px solid #333;
text-align: center;
display: inline-block
}
.first > ul {
list-style: none;
margin: 0;
padding: 0;
}
<div class="first"><h1>first div</h1><ul><li>text</li></ul></div>
<div class="second"><h1>second div</h1></div>
Run codeHide resultWhy is the second div moving down when I put the ul element inside the first div?
JS Bin link , just in case. Thank!
source
share