Old 16-06-2007, 16:14   #1 (permalink)
Haris
Registered User
 
Join Date: Jan 2007
Posts: 11
Image paths in CSS

How do I define image paths for background in CSS?

My images are located in images/gradients/header/bg.jpg and the CSS file is located in global/css/global.css

Code:
.headerbg{ background: url('/images/gradients/header/bg.jpg') repeat-x; }

This doesn't work.
  Reply With Quote
Old 16-06-2007, 16:55   #2 (permalink)
bluesage
Senior Member
 
Join Date: Dec 2006
Location: Switzerland
Posts: 351
try:

Code:
.headerbg{ background: url('../images/gradients/header/bg.jpg') repeat-x; }

or using full path: http://www.yourdomain.com/...

Depends on your folder structure and where the files are located.

if you put a ".." goes up to the parent folder of the current one.
  Reply With Quote
Old 16-06-2007, 19:19   #3 (permalink)
skyrocket
SkyRocket Design
 
skyrocket's Avatar
 
Join Date: Aug 2005
Location: Chichester
Posts: 538
might have to be ../../ as you've got to get out of css first then global
__________________
SkyRocket Design :: website design chichester
  Reply With Quote
Old 16-06-2007, 19:51   #4 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
That link is relative to the site root. It won't work if it's not on a web server.

Does it know the root URL - either the server's web root or one defined using a <base />?

Also, I believe quote marks (single or double) are not supposed to be there, but that's not causing your problem.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8