How to handle CSS relative paths in an ASP.NET MVC application.
Posted
by AngryHacker
on Stack Overflow
See other posts from Stack Overflow
or by AngryHacker
Published on 2010-03-21T04:53:43Z
Indexed on
2010/03/21
5:01 UTC
Read the original article
Hit count: 484
I have a master page, which has a style sheet, which has the following line:
.idle
{
background-image: url( '../../Images/blue_bg.png' );
}
All my pages inherit from this master page. And this works well when the URL is http://www.domain.com/home/details/5, however the URL is http://www.domain.com/home/create, then, of course, blue_bg.png cannot be found because `../../Images/blue_bg.png' resolves to a directory one higher where there is nothing there.
I tried the trick suggested by @codemeit in a similar question, but I can't plop down C# in a style sheet, can I?
How is this typically handled?
© Stack Overflow or respective owner