Skip to main content
Known Participant
September 29, 2017
Answered

Space between images

  • September 29, 2017
  • 1 reply
  • 683 views

Hi, on this site, on the mobile version, I have a small space between the images which I can't get rid off!!

EVISSI

Does someone have any idea??

    This topic has been closed for replies.
    Correct answer Jon Fritz

    That small horizontal space is the browser default text descender padding for inline elements.

    Essentially, because your images are inline elements, there is a small bit of padding for any text that would be next to them for the "leg" of the lower case letters that fall below the line, like "y" or "j", that way, the visual bottom of the rest of the text lines up correctly with the bottom of the image.

    There are a few ways to fix it, they all have their pros and cons.

    The easiest is to create a class/selector with vertical-align:bottom and then add that to those images. Another would be to change all images to block elements with img {display:block;} at the top of your css, though doing that might have unexpected results where you need to turn other images back to inline-block.

    1 reply

    Jon Fritz
    Community Expert
    Jon FritzCommunity ExpertCorrect answer
    Community Expert
    September 29, 2017

    That small horizontal space is the browser default text descender padding for inline elements.

    Essentially, because your images are inline elements, there is a small bit of padding for any text that would be next to them for the "leg" of the lower case letters that fall below the line, like "y" or "j", that way, the visual bottom of the rest of the text lines up correctly with the bottom of the image.

    There are a few ways to fix it, they all have their pros and cons.

    The easiest is to create a class/selector with vertical-align:bottom and then add that to those images. Another would be to change all images to block elements with img {display:block;} at the top of your css, though doing that might have unexpected results where you need to turn other images back to inline-block.

    MobosAuthor
    Known Participant
    September 29, 2017

    Ahaaa, just did it and it seems to be o.k. (preview in browser), thanks!