Closed MadMaxMcKinney closed 3 years ago
I tested this with regular html img
tags and there is no extra spacing at the bottom. This appears to be uniqe to StaticImg
Update: It appears changing .gatsby-image-wrapper-constrained
to be set to block
INSTEAD of the default inline-block
fixes the issue of having the additional space at the bottom. However, I don't know why that fixes it. Thoughts?
Solved: As mentioned above setting the display: block
will fix the extra bottom margin. Here's why it was happened for anyone curious.
I wanted to link to the images being shown so I wrapped the StaticImage
with an a
tag. That's when the extra space showed up! I eventually saw on the .gatsby-image-wrapper-constrained
class there was a display: inline-block
and if you changed it to display: block
it would fix the issue. The issue also only appeared when there was a wrapping container around the StaticImage
. Wellll... If you have display: inline-block
on an image it will provide space on the bottom to make room for descenders (since inline-block treats content like it was text). Descenders are parts of letters that reach down, like in 'y' and 'g'. So there you go! That's why there was that issue and how it got fixed!
I'm trying to put a wrapper around the
StaticImage
component fromgatsby-plugin-image
however I'm getting some ghost padding on the bottom of the images. I can't see anything in the CSS that is providing the padding. Does anyone know what I'm missing?Before:
Hovering (the ghost padding on bottom):
The generated code for the image and the wrapper:
Gatsby plugins and versions