Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Application root in CSS?

Application root in CSS?

Scheduled Pinned Locked Moved Web Development
questioncsharpcssasp-netsysadmin
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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.

    E D 2 Replies Last reply
    0
    • A Anonymous

      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.

      E Offline
      E Offline
      Edbert P
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • A Anonymous

        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.

        D Offline
        D Offline
        dwatkins dirq net
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups