1

I have four images as seen in this fiddle:

<img src='http://black-agency.com/dat/Images/BG/dark.jpg'/>
<img src='http://black-agency.com/dat/Images/BG/dark.jpg'/>
<br>    
<img src='http://black-agency.com/dat/Images/BG/dark.jpg'/>
<img src='http://black-agency.com/dat/Images/BG/dark.jpg'/>

I have removed padding and margin, and yet space remains between the pictures.

How can I have the pictures be immediately adjacent, without space?

Randomblue
  • 112,777
  • 145
  • 353
  • 547

2 Answers2

6

You can remove the spaces with Del:

<img src='http://black-agency.com/dat/Images/BG/dark.jpg'/><img src='http://black-agency.com/dat/Images/BG/dark.jpg'/><br><img src='http://black-agency.com/dat/Images/BG/dark.jpg'/><img src='http://black-agency.com/dat/Images/BG/dark.jpg'/>

Browsers interpret newlines as space, so you should remove them if you don't want to have one space there.

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0

You can mess around with floating instead of relying on inline-block default styling, though in this case it would probably be quite complicated.

You could set the font size of the parent to nothing. See this fiddle.

You could set negative margins. See this fiddle.

Or finally, you could remove the whitespace between the img tags in the markup, however, this can make the markup look messy.

Its really up to you to decide which is the best method in your particular situation. Note that background images are more suited to the CSS background-image property and background shorthand property if those images were not just placeholders.

James Coyle
  • 9,922
  • 1
  • 40
  • 48