Now, the difference between inline and inline-block elements is that inline element does not allow for margin-top or margin-bottom as compared to inline-block elements. However, in the below example, whenever I apply a margin to the inline-block element, a margin appears for the inline ones too. Can anyone tell me why? I have spent over an hour trying to figure out but failed.
<html>
<head>
<style>
div {
background:yellow;
margin:10px;
height:70px;
}
a {
display:inline;
background-color:#FFF;
width:20px;
height:20px;
border:solid black 1px;
}
span {
margin-top:10px;
display:inline-block;
background:red;
}
a, span{
vertical-align:center;
}
</style>
</head>
<body>
<div>
<a>abcd</a>
<a>efgh</a>
<span>Some text</span>
</div>
</body>
</html>
Here both the abcd and efgh elements have the same 10px margin as the span.
