Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
background images with css
Old 03-23-2009, 09:33 PM background images with css
Experienced Talker

Posts: 39
Name: Scott Bronson
Trades: 0
when I write my CSS background colors will show up but not my images, I need to know what I'm doing wrong,, here is the code I'm using
Body{background-image: url(file:///C|/Users/Dreamster/Pictures/banner for website.jpg);
sbronson is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-23-2009, 10:13 PM Re: background images with css
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Well, you've got a URL pointing to a local file, which is a bad idea. When you code a site, you should keep a logical file structure, say with the home page top level (some keep all pages top level), a folder for images, a folder for scripts, and so on. Your CSS would then be:

body{background-image: url('images/banner_for_website.jpg');}

Remember the quotes, too. The image, of course, would be in the images folder. Also, avoid spaces in file names; use underscores if you need a space.

By doing it that way, it doesn't matter if you look at the page on the Web, on your computer, or on another computer off of a thumb drive, it will function the same way.

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 03-23-2009, 10:16 PM Re: background images with css
Experienced Talker

Posts: 39
Name: Scott Bronson
Trades: 0
I havent tried to upload it yet still in the design stage. I'm using DW 8
I would think the file name would be ok.
sbronson is offline
Reply With Quote
View Public Profile
 
Old 03-23-2009, 10:35 PM Re: background images with css
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Local file names will show up if you are viewing a local web page in a browser. Local URLs should never be in your source code, on the other hand. Your website should be an island unto itself, so to speak, and that which is within it points to what is within it. The exception, of course, is for outside links, which should use absolute (that is, complete) URLs.

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 03-23-2009, 10:54 PM Re: background images with css
Banned

Posts: 1
Name: Lance
Trades: 0
Even if you are trying to view that locally, that link looks bad

file:///C|/Users/Dreamster/Pictures/banner for website.jpg

Have you tried uploading to a free image host?

Last edited by Lpe04; 03-23-2009 at 10:57 PM..
Lpe04 is offline
Reply With Quote
View Public Profile Visit Lpe04's homepage!
 
Old 03-24-2009, 02:38 PM Re: background images with css
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
Remember the quotes, too.
You don't need the quotes at all, as they have no effect. If the path is correct relative to the css file, then the image should show up.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-24-2009, 05:55 PM Re: background images with css
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Maybe you are on another level down on the website? Often there is a CSS folder that leads to the CSS page. In this case the path would be url(../images/image_name.jpg) to go up one level.
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Reply     « Reply to background images with css
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33527 seconds with 12 queries