Dealing with Images in CSS and StyleSheetManager

2 posts, 0 answers
  1. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 24 Aug 2011 Link to this post

    I would like to implement a RadStyleSheetManager to roll-up a couple of custom CSS files along with a custom skin with 13 CSS files.  This seems to work fine for everything, except the images in the CSS.  The links come out wrong.  It appears that they now need to be absolute paths - which would be fine in some situations - however ...

    I have a small web application that may be installed inside a virtual directory or at a root level - so if I point the CSS images to '/resource/images/picture.png' this will not work if the application is installed at any level other than the root.

    Is there an easy way to fix this?  If I were dealing with server controls I would use '~/resource/images/picture.png' - but I do not believe you can do this in a CSS.  
  2. Simon
    Simon avatar
    2281 posts

    Posted 29 Aug 2011 Link to this post

    Hi Dan,

    The URLs of the images actually can be relative to the location of the CSS file that references them, there is no need for absolute paths. The Telerik.Web.UI.WebResource.axd handler is always requested from the root of the application, so the CSS files will be relative to the root and their images' URLs will be relative to their CSS files locations.

    Unless I am missing something, relative URLs will suffice.

    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft R3 2016 release webinar banner
Back to Top