<ul>
<li>List1</li>
</ul>
and simple CSS:
li {
background-color:pink;
padding:5px;
margin:40px;
}
ul {
list-style-type:none;
background-color:blue;
}
Why isn't the vertical margin working? Margin-right/left work, but why isn't the top/bottom working? "list-item" should be a block-level element, right? So, why isn't the vertical margin respected then?
Height seems to be working, but vertical margin doesn't.
However, if you add a second "li" sibling,
<ul>
<li>List1</li>
<li>List2</li>
</ul>
and add margin to both,
li {
background-color:pink;
padding:5px;
margin:50px;
}
the top margin of "list2" and the bottom margin of "list1" collapse, but create space nontheless, which means they worked, however, the bottom margin of "list2", and the top margin of "list1" still don't work. Why?
NOTE: I know that i can make the list-item into an inline-block, and the vertical margins would be respected, but my question is, why aren't they respected NOW.