Application root in CSS?
-
How do I specify the application root in CSS syntax? (Similar to the functionality of "~" in ASP.NET) Or is there a way I can insert it dynamically from server code, such as: background-image: url( <% some server code or variable here %> ) Would the syntax above work? Thanks.
-
How do I specify the application root in CSS syntax? (Similar to the functionality of "~" in ASP.NET) Or is there a way I can insert it dynamically from server code, such as: background-image: url( <% some server code or variable here %> ) Would the syntax above work? Thanks.
Anonymous wrote:
background-image: url( <% some server code or variable here %> ) Would the syntax above work? Thanks.
Depends. If you have that code in an aspx page then it will work, but if you have it in your css file then it won't as it will not be processed. You can either: 1. Use absolute path of for your image (e.g. /images/bg.gif or http://website/images/bg.gif ) The first / before the folder name defines the root path to your URL, you can follow it up with directory name or file name. 2. Use Response.Write or <% %> to create your dynamic CSS within your ASPX page. There are probably other ways such as creating a .css file from your ASPX code and include it dynamically and such. Does that help? Edbert P. Sydney, Australia
-
How do I specify the application root in CSS syntax? (Similar to the functionality of "~" in ASP.NET) Or is there a way I can insert it dynamically from server code, such as: background-image: url( <% some server code or variable here %> ) Would the syntax above work? Thanks.
I don't think there is a way to get the application root since that is derived from asp.net. You can, however, use the css file as the root. So if your file is dirq.net/parthOffRoot/image.png and your css file is dirq.net/css/style.css you can use the url keyword: url(../pathOffRoot/image.png); Like: ul{ list-style-image: url(../structure/sel_box.gif); } Dirk Watkins