Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem setting css style using relative path

Reply
Thread Tools

Problem setting css style using relative path

 
 
PeterKellner
Guest
Posts: n/a
 
      07-29-2006
I'm having trouble setting a background style in a master page. The
declaration in the master page looks like this:

<div id="header_image" runat="server" style="background: transparent
url(images/bg_header.jpg) repeat-x scroll 0% 0%;;cursor: pointer;">

</div>

I tried adding runat="server" as well as changing the url to
~/images/bg_head.jpg but that didn't work.

Any suggestion on how to make the bg_header.jpg work on a master that
can be referended from aspx pages in subdirectories?

Thanks
Peter Kellner
http://peterkellner.net
 
Reply With Quote
 
 
 
 
msnews.microsoft.com
Guest
Posts: n/a
 
      07-29-2006
~ is resolved using ResolveClientUrl(). As there is nothing in the CSS that
uses this routine, it will fail.

A couple of solutions.

1. Create the master page for the upper level and then another for indention
(a level off root)

2. Create the image link from web root, which means, for virtual
directories, you use the name of the virtual directory in the link. This
works, although it is not too elegant.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
"PeterKellner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm having trouble setting a background style in a master page. The
> declaration in the master page looks like this:
>
> <div id="header_image" runat="server" style="background: transparent
> url(images/bg_header.jpg) repeat-x scroll 0% 0%;;cursor: pointer;">
>
> </div>
>
> I tried adding runat="server" as well as changing the url to
> ~/images/bg_head.jpg but that didn't work.
>
> Any suggestion on how to make the bg_header.jpg work on a master that
> can be referended from aspx pages in subdirectories?
>
> Thanks
> Peter Kellner
> http://peterkellner.net



 
Reply With Quote
 
 
 
 
PeterKellner
Guest
Posts: n/a
 
      07-30-2006
On Sat, 29 Jul 2006 16:03:25 -0500, "msnews.microsoft.com"
<(E-Mail Removed)> wrote:

>~ is resolved using ResolveClientUrl(). As there is nothing in the CSS that
>uses this routine, it will fail.
>
>A couple of solutions.
>
>1. Create the master page for the upper level and then another for indention
>(a level off root)
>
>2. Create the image link from web root, which means, for virtual
>directories, you use the name of the virtual directory in the link. This
>works, although it is not too elegant.


Hi,

I don't quite understand what you mean by #2. Are you suggesting
spelling out the domain name in the css file? If so, I think that
would mean I'd have to change that each time I moved from one domain
to another (like testing to non-testing).

If you could explain, that would be a great help.
Peter Kellner
http://peterkellner.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control doesn't work (fail in client side early stages) when path is relative i.e "\\path.." Oren ASP .Net 1 04-29-2007 04:20 PM
How do I convert an absolute path into a relative path Nigel Wilkinson Ruby 2 07-25-2005 07:37 PM
absolute path versus relative path in JSP Matt Java 3 07-08-2004 08:31 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
Make a relative url path from an absolute path to another one Thomas Guettler Python 3 10-27-2003 04:41 PM



Advertisments