if i use this code (with spaces between the two tags):
<img src="....." style="border:0px;margin:0px" />
<img src="....." style="border:0px;margin:0px" />
there are 4 pixels between images. if I use this:
<img src="....." style="border:0px;margin:0px" /><img src="...." style="border:0px;margin:0px" />
the space between images disappear, on all browsers!
Why????????
Usually, it is preferable to have a little space between the image and the surrounding text. In HTML, you provide this space by using the vspace and hspace attributes within the img element. In CSS, to align an element with no text wrap, apply the text-align property to a block-level element that contains the image.
The < > tag creates a space that does not break into a new line. Two words that are separated by a non-breaking space always appear on the same line. You can also add space around text using Cascading Style Sheets (CSS).
The simplest way to add a space in HTML (besides hitting the spacebar) is with the non-breaking space entity, written as or  . Multiple adjacent non-breaking spaces won't be collapsed by the browser, letting you “force” several visible spaces between words or other page elements.
That's because white space is significant for inline elements. You can always float your images if you want to have them line up.
Edit: As requested, here is a simple example:
/* This is used to "clear" the floated elements */
.images { overflow: hidden; width: 100% }
/* float the elements so that white space does not matter */
.images img { float: left; }
<div class="images">
<img src="http://dummyimage.com/150x100/000/fff&text=first+image" alt="first image" />
<img src="http://dummyimage.com/150x100/6aa8de/fff&text=second+image" alt="second image" />
<img src="http://dummyimage.com/150x100/ff6500/fff&text=third+image" alt="third image" />
</div>
<img src="http://www.nataliedee.com/111908/whatever-dude-whatever.jpg" style="border:0px;margin:0px;float:left;width:200px;" />
<img src="http://www.nataliedee.com/111908/whatever-dude-whatever.jpg" style="border:0px;margin:0px;clear:both;width:200px;" />
http://jsfiddle.net/JNWc7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With