I am currently dealing with the following HTML and CSS setup:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0;
}
.row {
background-color: red;
/* display: inline-block; */
}
ul {
list-style: none;
padding: 0;
}
ul li {
border: 2px solid green;
display: inline-block;
margin: 0;
padding: 15px;
}
<div class="row">
<ul>
<li>one</li>
<li>two</li>
<li>one</li>
</ul>
</div>
When I incorporate inline-block
in my CSS, the layout displays as shown below:
https://i.sstatic.net/dbGv1.png
However, when I remove display:inline-block
, the layout appears like this (assuming display is block
by default):
https://i.sstatic.net/tghQy.png
Now, where does this vertical padding originate from?