Welcome to WebmasterWorld Guest from 54.147.134.218

Forum Moderators: not2easy

Message Too Old, No Replies

CSS question

spacing between images

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

Junior Member

10+ Year Member

joined:July 24, 2001
posts:53
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 7, 2001
posts:661
votes: 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!

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

Junior Member

10+ Year Member

joined:July 24, 2001
posts:53
votes: 0


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

gph

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

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 0


Could someone explain why it is necessary to have everything on the same line?
5:18 am on Apr 30, 2002 (gmt 0)

Senior Member

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

joined:May 26, 2000
posts:37301
votes: 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

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

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 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)

Moderator

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
posts:8137
votes: 102


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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members