Could someone explain to me why there is a space between
the inline-block elements in the following code.
I can increase the margin spacing, but I can not eliminate it
and I have no reason or explanation why.
?
[code]
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″ />
<title> inline-block demo </title>
<!– From: https://css-tricks.com/snippets/css/clear-fix/ –>
<style>
.box { height: 150px; width: 25%; border: 1px solid black; }
.inline-block { display: inline-block; margin: 0; background-color: lime; }
</style>
</head>
<body>
<div> <h2>inline-block Class</h2>
<div class=”box inline-block”>inline-block 1</div>
<div class=”box inline-block”>inline-block 2</div>
<div class=”box inline-block”>inline-block 3</div>
</div>
<div>
inline-block element<br>
Why the spaces between the blocks when margin:0 ?
</div>
</body>
</html>