2 replies [Last post]
jacky
Offline
newbie
Last seen: 16 years 17 weeks ago
Joined: 2003-08-14
Posts: 8
Points: 0

When defining background-image in external style sheet, it's url path is with reference to the stylesheet itself. Can the reference be changed to the document it applied?

The story is that there are several categories in my pages, each category has its own directory. In each category there will be a heading which uses background-image, these background-images use the same name (e.g. top.jpg), but different pictures. placed within their corresponding diretory. So I'm thinking if there is a way to let the background-image code place in the style sheet, not within the HTML code.

Pob
Offline
Enthusiast
Hampshire UK
Last seen: 8 years 26 weeks ago
Hampshire UK
Timezone: GMT+1
Joined: 2003-08-16
Posts: 60
Points: 5

background-image url reference

Hi,

Probably the easiest way around this is to put the heading style rule in the head of each page that needs a different image. (assuming that all the directory structures are the same).

Or set up a class for each different heading with the different images defined etc and put that in your external stylesheet.

Paul

jacky
Offline
newbie
Last seen: 16 years 17 weeks ago
Joined: 2003-08-14
Posts: 8
Points: 0

background-image url reference

That's what I do now, by adding inline style into the heading elements.

Using different class is a good idea, so that I can put all my images into one folder, but using different names. Thank u.