My understanding is that in HTML, a forward slash represents the Web Root and therefore whether the page referencing this stylesheet is in the Web Root itself (e.g. "index.php") or in another sub-directory (e.g. "pages/article_index.php") the pages should be able to find my background image?!

Unfortunately, SitePoint doesn't do a very job describing the URI/URL thingy... :-/

(Paths have got to be one of my weaknesses?!) GRRRR

Debbie

ralphm
—
2011-12-04T02:12:45Z —
#10

It the H1 appearing on pages but not the bg image? If the H1 is appearing, then presumably the include is working. There is nothing wrong with the CSS, so something else is amiss. As usual, a link would be helpful.

system
—
2011-12-04T02:17:04Z —
#11

tbh, I find absolute paths can be a pita so I always use relative paths instead.

You're using an absolute path in that url, so the actual path you are specifying is the path to your web root directory appended with your absolute path.

Have a look at what your web root path actually is, then append the path in your "url" and see if the image exista at that "full" path. Otherwise consider using relative paths. If using relative paths, the path to a file (image or whatever) needs to be relative to the directory containing the file your css is in.

Like I said, I find relative paths a lot less problematic - but that's just me

ralphm
—
2011-12-04T02:24:45Z —
#12

webdev1958 said:

tbh, I find absolute paths can be a pita so I always use relative paths instead.

Weird. tba, I find relative paths can be a pita so I always use absolute paths instead. You can set the path and not have to think about it again, no matter what page you are linking from. The only problem can be with PHP includes etc., where a url is not enough. For example, with includes you need something like

But I suspect DD is working locally, in which case—as you say—the absolute URLs might not actually be pointing to the web root. I gues that's the other problem with absolute urls, but I don't work locally much, and when I do, I set up virtual hosts so that the web root locally is the same as remotely.

system
—
2011-12-04T02:36:41Z —
#13

[ot]

webdev1958 said:

tbh, I find absolute paths can be a pita so I always use relative paths instead.

ralph_m said:

Weird. tba, I find relative paths can be a pita so I always use absolute paths instead.

oh dear :rofl:

Yin and yang perhaps? :lol:

For me it's just a personal choice - I just prefer, because I find things work much easier that way, to specify relative paths from the website's root folder, except for url's in the css file where they have to be relative to the folder the css file is in.

[/ot]

I'm not sure what you mean by "locally". I do all my coding on a "local" web server (xampp) and so it is essentially the same as working on the www.

DoubleDee
—
2011-12-04T02:38:05Z —
#14

ralph_m said:

It the H1 appearing on pages but not the bg image?

Yes.

If the H1 is appearing, then presumably the include is working.

Bingo!

There is nothing wrong with the CSS, so something else is amiss. As usual, a link would be helpful.

Let me upload all of my files - which is a pain - and see if that helps.

Debbie

DoubleDee
—
2011-12-04T02:47:29Z —
#15

ralph_m said:

It the H1 appearing on pages but not the bg image? If the H1 is appearing, then presumably the include is working. There is nothing wrong with the CSS, so something else is amiss. As usual, a link would be helpful.

Ralph, this is one time me posting my code won't help you...

Why?

Because the PITA image is a "background" image, and when I run my index.php this is the source I see...

which is saying go up 1 level and then drill down into the images folder to the image file.

If this works, then at least you will then know that your absolute path is specified incorrectly or there is something else going on.

Edit:

I didn't see your last post before I submitted this post - glad you sorted it out

As far as I recall, relative versus absolute paths for things like this don't matter. (I prefer absolute.)

As long as you don't change the directory structure, it shouldn't matter.

PHP includes are a different beast, and having a "config" file with a reference to your Web Root is often really helpful, so there, absolute wins.

Debbie

system
—
2011-12-04T03:52:36Z —
#20

DoubleDee said:

As far as I recall, relative versus absolute paths for things like this don't matter. (I prefer absolute.)

That's right and is exactly what I said earlier - it boils down to personal preference.

If you look at my previous post you will see the point of trying a relative path in this case, which would have worked if you had not forgotten to assign a stylesheet, was to test if the absolute path from your web root was correct or not.

As it turns out, the relative path would not have worked either because YOU FORGOT TO ASSIGN A STYLESHEET :rolleyes: