homepage Welcome to WebmasterWorld Guest from 23.23.9.5
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
CSS question
spacing between images
JakeFrederick

10+ Year Member



 
Msg#: 37 posted 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?

 

msr986

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 37 posted 2:39 am on Aug 25, 2001 (gmt 0)

Jake,
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!

JakeFrederick

10+ Year Member



 
Msg#: 37 posted 2:51 am on Aug 25, 2001 (gmt 0)

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

gph

10+ Year Member



 
Msg#: 37 posted 2:39 am on Apr 30, 2002 (gmt 0)

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

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 37 posted 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.

gph

10+ Year Member



 
Msg#: 37 posted 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.

ergophobe

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 37 posted 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 ]

Cheers,

Tom

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