Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference root folder in background:url()

Status
Not open for further replies.

Crowley16

Technical User
Jan 21, 2004
6,931
GB
Hi Everyone,

I've got a site with an images directory and a secure directory.

The site contents are in the secure directory, with a login page and a banner page in the root. The banner page is reused on the secure pages as well.

The problem I'm having is, on the banner page, I use background: url(Images/image.jpg). this works fine for the login page, but on the secure pages, the images aren't shown.

I know it's a path problem because changing the url to ../Images/image.jpg works on secure pages but not on the logo.

So, my question is, how do I get the url to reference the absolute path, including the root folder, i.e. url(~/Images/Image.jpg)

I've tried all the standard things I can think of but nothing works.

Thanks

--------------------
Procrastinate Now!
 
I've found a work around by copying the images folder and putting it in the secure directory.

however this isn't ideal as I'd like to centralise images, so if there's a better solution, I'd still like to hear it.

Thanks

--------------------
Procrastinate Now!
 
that's something I have tried, and it doesn't work.

my full tag is:
Code:
<table cellpadding="0" cellspacing="0" 
	style="width:100%;height:50px;background:url(Images/TopBanner.jpg) right top;"
>

could something else be interfering with this to stop it working?

--------------------
Procrastinate Now!
 
Yes, your reluctance to include the forward slash at the beginning of the url. Check my line again:
Code:
url([!]/[/!]Images/Image.jpg)

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Sorry for the late reply, but had to finish off this project...

Yes, I tried with the / slash

I've tried:
/Images/Image.jpg
~/Images/Image.jpg
//Images/Image.jpg
and lots of other combinations, none of which work...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top