Set vertical-align: bottom to the CSS image.
The reason this happens is because the images are displayed in a line with text. This means that they should allow a small space under the line in the case of letters such as y , g , etc., which fall below the baseline and cause a space.
By setting vertical-align to bottom , you move the image so that it aligns with the bottom of the text, avoiding this problem.
There is one exception that you should be aware of: if the image has a lower height than one line of text, it will leave a space above it to make room for this text, unless you set the containing element to line-height , which works.
source share