This is a migrated thread and some comments may be shown as answers.

Dealing with Images in CSS and StyleSheetManager

1 Answer 40 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 24 Aug 2011, 05:09 AM
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.  

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 29 Aug 2011, 03:19 PM
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.

Regards,
Simon
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 >>

Tags
ScriptManager and StyleSheetManager
Asked by
Dan
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or