Answer the question
In order to leave comments, you need to log in
Why is there padding around an inline SVG image?
A strange glitch is happening. If you add a div with padding-top before the svg image, then padding appears to the left and right of the svg image. Moreover, if the images are replaced with png, then there is no indentation. If this div is removed or hidden, then the padding disappears. In Chrome, the glitch disappears (in Firefox it persists) if you insert an empty div without indents between the div and the picture. Also in Chrome, the glitch disappears if the image height is specified not in em, but in px. Why is this happening?
For clarity, I simplified the code as much as possible while preserving the glitch. On a real page, these indents are even larger. To show the dimensions, I added a frame to the image.
<div style="padding-top: 0.6em;">
Текст2
</div>
<img src="file.svg" style="height:1.651em; vertical-align: -0.528em; border: 1px dotted gray;">.
<div style="padding-top: 0.6em; display: none;">
Текст2
</div>
<img src="file.svg" style="height:1.651em; vertical-align: -0.528em; border: 1px dotted gray;">.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question