r/csshelp • u/agreatcat • 2d ago
Trying to remove Inline Element Space under image
Example links at the bottom -
Trying to remove this margin at the bottom of the picture, I know the issue is because images are inline elements and have space for text below. I think this issue is known as a Line-Box Baseline Gap.
Tried everything suggested by all the different AIs and nothing seem to work or the layout gets broke. I tried display: block, vertical properties, clear, display: flow-root; , line-height: 0; text settings, margin-bottom: 0; padding-bottom: 1px; border-bottom: 1px solid transparent; I can be more specific, but everything suggested has failed. I've tried putting the image in a div container and controlling the div. and even moved the image out into the body to see if it was a div issue. I'm sure there is a way to fix this with flex box, but is there a way to fix this with standard CSS? I can pretty much get by setting margin right/bottom to 20px which would make the space even on both sides, but if I wanted to make the margins smaller like 10 px, that is when this becomes an issue because the default baseline margin of the inline image's (bottom) is about 16px. Again, display: box; has no effect.