6

Apparently svgs are inline by default:

div {
  background-color: red;
}

svg {
  height: 100px;
  background-color: blue;
}
<div>
  <svg></svg>
</div>
<br>
<div>
  <svg style="display:block;"></svg>
</div>

Setting display: block on the svg, it removes the extra height.

Does anyone know why this happens?

Ivar
  • 6,138
  • 12
  • 49
  • 61
FellowMD
  • 2,142
  • 3
  • 16
  • 15

0 Answers0