I am trying to overlay a couple of links on an image. It works using position: relative but there now is a gap beneath the image which wasn’t there before I added the extra div.
IIRC using position: relative, the space the div would have taken up is still used (and empty). That seems to be what’s happening.
(How) can I remove the empty space? I’m probably being a numpty.
Ah - I didn’t explain that properly. It’s the white space between the two images (below the banner and above the “I am therefore I meet” image) I’m trying to eliminate (or at least some of it).
The difference shows if you hover over the “lang” div in the inspector. Then you will see the difference:
The table display shrink wrap the div to its content while the default div expand to fill avaiable horizontal space. Here the remaining 94% on the right hand.
As @Erik_J explained it is a shrink-to fit algorithm just like the inline-block you were using so I assumed you wanted it as shrink to fit (which would seem sensible as you don’t want it layered over anything else by mistake).
Unlike inline-block the negative margin-top is applied correctly (I’m guessing that’s why you were tempted to use position:relative and moving it with a top value).