PDA

View Full Version : Spacer Gif, do I need to put it in the images folder?


Steven_Smith
03-28-2003, 06:58 PM
Hey. I was told that if i were to use

<img src="spacer.gif" width=29 etc...

I wouldn't have to have the 1x1 'spacer.gif' on the server.

Is that true?

Or would I see a broken image...

Thanks
Steve :thumbsup:

redhead
03-28-2003, 07:11 PM
If you are going to use an image it needs to be the web somewhere, or the browser isnt gonna know where to look for it! but if in doubt, try it out:

<img src="spacer.gif" width="100" height="300" alt="This is spacer.gif">

without spacer.gif in the directory of course... unless you mean its on another server? then you'd use <img src="http://example.com/images/spacer.gif" width="100" height="300" alt="This is spacer.gif"> or whatever...

Steven_Smith
03-28-2003, 07:19 PM
i was hoping that when I use alot of 1x1 spacer gifs, I wouldn't need them on th server. Like the browser new that it was a spacer gif.

Spookster
03-28-2003, 07:25 PM
The browser is going to look for any files attached to the page. If you put the spacer image in the page 1000 times and it doesn't exist in the cache then it will look for it 1000 times which will delay loading of the page.

Is there a particular reason you don't want to put the image file on the server or was you just curious?

Steven_Smith
03-28-2003, 07:28 PM
I was just curious Spooks. A pal of mine told me that I didn't need it and that the browser new it was just for layout.

I thought it would show a broken image. Some browsers did, some didn't.

Thanks for the help.

(I can now say I told you so too this guy, yeay I win!)

Steve

Borgtex
03-28-2003, 07:32 PM
Originally posted by Steven_Smith
i was hoping that when I use alot of 1x1 spacer gifs, I wouldn't need them on th server. Like the browser new that it was a spacer gif.

Well, but you don't need to have one copy of the file for every time you use it on a page. Besides that, the size of spacer.gif is ridiculous, and if your browser puts it in the cache, it's only downloaded once

mouse
03-28-2003, 10:20 PM
You don't need an image, <img src="#" width="100px" height="1px"/> will work as a spacer.

brothercake
03-28-2003, 10:52 PM
Originally posted by mouse
You don't need an image, <img src="#" width="100px" height="1px"/> will work as a spacer.
Not reliably; early netscapes and mosaics will show a big square broken-image box for something like that. And have you ever looked at your server's error logs after a day of that ...? I think if you use spacer images, the image should really exist.

BTW - spacer gifs are a big problem in DHTML - if the spacer gif is inside a dynamic layer whose visibility or display you change through script, then everytime you make it visible, IE5 and IE6 will reload the image; with a tiny gif you may barely see it happen ... but for the server ... on a popular site ... it can be like a mini DOS attack.

Scuse me for asking ... why spacer gifs at all? Spacer gifs are so 20th century ;) you want CSS :)

justame
03-28-2003, 11:28 PM
Originally posted by brothercake
Scuse me for asking ... why spacer gifs at all?

/me just a whispers® to bro...
welll...mayyybe 'cause theyyy go together just a like® cookies/milk...chips/dip...netscrap/spacer.gif ...hehehe...

brothercake
03-28-2003, 11:31 PM
Originally posted by justame
/me just a whispers® to bro...
welll...mayyybe 'cause theyyy go together just a like® cookies/milk...chips/dip...netscrap/spacer.gif ...hehehe...
Yeah maybe they do ... can't help but think of moths/flame :D

But hey if it's nutscrape 4 you're concerned about, you can use <spacer>

Steven_Smith
03-30-2003, 06:40 PM
Well Brother Cake, CSS is the way to go. My problem is that I can layout a page so fast with spacer gifs. I guess its time to get out of the 20th century.

Thanks People.

Steve

oracleguy
03-30-2003, 10:11 PM
I know what you mean, but once you start building your site layouts with CSS they become even easier to write. I used to be die hard tables kinda person but once I tried doing a site with CSS a while back instead of tables, I was sold.

meow
03-30-2003, 10:28 PM
Revive the spacer tag! :D
http://www.blooberry.com/indexdot/html/tagpages/s/spacer.htm

Steven_Smith
03-31-2003, 01:20 AM
What about browser incompatibilities. When I tried CSS awhile back every browser treated the page differently. I use them for FONT but thats about it.

Do browsers treat CSS the same if they are being used for page layout?

Could I use CSS to display data that I get from a database? Right now I build a table then loop the database. then close the table. Can I do that with the CSS?

:cool:
Steve

cg9com
03-31-2003, 03:23 AM
CSS support goes back to NS4 IE4 i believe, but its dodgy. ;)
CSS is a client side technology so no, no database manipulation etc.
Yes CSS can be used for layout, and/or styling of elements.

W3Schools - CSS (http://www.w3schools.com/css/css_intro.asp)