Problem with locating url of an image in css

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Problem with locating url of an image in css

Postby shnjavi » 24. March 2010 22:48

Hello, I'm kind of a newbie on here, and I will ask a question as simple as I can, so.. I reinstalled xampp 1.7.2. and my root folder is now "htdocs". The problem is:
In my css file I have to locate a background image. When I had located it (with the previous installation) I used the code:

Code: Select all
background: url('images/polaroid.jpg');


but now I have to write this, in order to work properly:

Code: Select all
background: url('http://localhost//images/polaroid.jpg');


Can someone please help? What seems to be the problem? I would be really grateful! Thanks. And sorry about my English :oops:

One question more.. How can I change my root folder, e.g. if I want it to be beneath "htdocs" folder , e.g. "htdocs/newfolder" (how to make "newfolder" my default?)
shnjavi
 
Posts: 2
Joined: 24. March 2010 22:19

Re: Problem with locating url of an image in css

Postby MisterK » 24. March 2010 23:01

perhaps you need to change the reference to an absolute one -
rather than:
Code: Select all
url('images/polaroid.jpg');

try:
Code: Select all
url('/images/polaroid.jpg');


Seems like either the page you are viewing, or the css file you are referencing isn't in the root area. I can't remember which matters off the top of my head (maybe both)
MisterK
 
Posts: 4
Joined: 24. March 2010 21:37

Re: Problem with locating url of an image in css

Postby MisterK » 24. March 2010 23:03

To your second question, your root folder is listed in httpd.conf.
MisterK
 
Posts: 4
Joined: 24. March 2010 21:37

Re: Problem with locating url of an image in css

Postby shnjavi » 25. March 2010 18:50

Thank you for answering.
Yes, I've found it, somewhere in line 225 or so, in httpd.conf, and all my links on html page are successfully connected.

But still, in my css file, background images can't work properly if I don't use this path:

Code: Select all
background: url('http://localhost//images/polaroid.jpg') no-repeat;



Why do I have to write http://localhost? I don't understand :(
shnjavi
 
Posts: 2
Joined: 24. March 2010 22:19


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 104 guests