homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

CSS question
spacing between images

 1:06 am on Aug 25, 2001 (gmt 0)

I'm trying to layout a navigation bar thats going to have 6 or 7 images side by side. I figured it would be easier to position them by adding a class to define their vertical position, but just letting the document flow determine the horizontal position, rather than positioning each one separately. When placing two images side by side (by using the <img> element twice in a row) there's a space of a few pixels between the images. Is there a way in CSS to remove this space? Or is it best to just make an ID for each part of the nav bar and position them each separately. Or maybe I should just use an image map............. Any suggestions?



 2:39 am on Aug 25, 2001 (gmt 0)

You don't need CSS to remove the spaces. Put all of your <img> tags ON THE SAME LINE, without a space or newline.

Like this:

<img src="x.jpg"><img src="y.jgp"><img src="z.jpg">

This will work, money back guarantee.

Buy the way, welcome to the forum!


 2:51 am on Aug 25, 2001 (gmt 0)

aha! Guess I need to brush up on my html! thanks.....


 2:39 am on Apr 30, 2002 (gmt 0)

Could someone explain why it is necessary to have everything on the same line?


 5:18 am on Apr 30, 2002 (gmt 0)

The main issue is cross-browser display. Even though line breaks and extra spaces in HTML code are "supposed to be" ignored by browsers, in practice that's not the way it always works out.

Newer browser versions are pretty good on this, but Netscape 4, for instance, and some earlier IE5 versions had nasty little display quirks that would crop up around line breaks and spaces.


 5:34 am on Apr 30, 2002 (gmt 0)

Thanks for the info Tedster. I've run across this a couple of times and had no idea why it was happening.


 5:55 am on Apr 30, 2002 (gmt 0)

Strictly speaking, this is not a browser error. Generally you want a line break in source to be interpreted as a space, but the case of images and links are an exception.

Anyway, CSS gives you some noteworthy advantages over tables for displaying images and captions. Check out the following:

[glish.com ]

[bluerobot.com ]
[thenoodleincident.com ]



Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved