reason to use inline over inline-block code example
Example 1: what does display inline-block do?
/*Compared to display: inline, the major difference is that
display: inline-block allows to set a width and height on the element.
Also, with display: inline-block, the top and bottom margins/paddings are
respected, but with display: inline they are not.
Compared to display: block, the major difference is that
display: inline-block does not add a line-break after the element,
so the element can sit next to other elements.
The following example shows the different behavior of
display: inline, display: inline-block and display: block: */
span.a {
display: inline; /* the default for span */
width: 100px;
height: 100px;
padding: 5px;
border: 1px solid blue;
background-color: yellow;
}
span.b {
display: inline-block;
width: 100px;
height: 100px;
padding: 5px;
border: 1px solid blue;
background-color: yellow;
}
span.c {
display: block;
width: 100px;
height: 100px;
padding: 5px;
border: 1px solid blue;
background-color: yellow;
}
Example 2: inline-block
An inline block is placed inline (ie. on the same line as adjacent content), but it behaves as a block. Its inline but we can add width height etc