I have the following code:
body { background-color: black; }
.root { background-color: aqua; }
.svg-container { background-color: lightgray; }
svg { background-color: red; }
.btn { background-color: yellow; }
.svg-container, .btn {
display: inline-block;
}
svg {
height: 60px;
width: 60px;
}
svg, .svg-container, .btn {
margin: 0;
padding: 0;
border: 0;
}
<html>
<head></head>
<body>
<div class="root">
<div class="svg-container">
<svg></svg>
</div>
<button class="btn">Button</button>
</div>
</body>
</html>
I expected the height of .svg-container
to be exactly equal to the containing svg
= 60px. Further, the .btn
should have been on the top side and not bottom. Another interesting thing with .btn
is that it has a lot of space above it yet there some gap between the .btn
and the containing .div
.
Why is it happening?