Click here to Skip to main content
11,629,285 members (72,867 online)
Click here to Skip to main content

Relative Path Solution for Master Pages

, 20 Feb 2012 CPOL 10.2K
Rate this:
Please Sign up or sign in to vote.
A relative path solution for master pages.

If you are having issues with your web pages not displaying background images and you are using a masterpage, the problem could be because the path to the image is relative to the page itself and not the masterpage.

To fix this issue, add a link to a CSS file in your masterpage instead of using inline styles.

<link href="css/Main.css" rel="stylesheet" type="text/css" />

This makes the image path become relative to the linked CSS file instead of the page.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

FrostedSyntax
JBH Works
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 1 This will not work in url rewrite pa... Pin
Mukund Thakker22-Feb-12 17:46
memberMukund Thakker22-Feb-12 17:46 
GeneralYou can use the full url, if you have url rewrite. &lt;link ... Pin
Mukund Thakker22-Feb-12 17:44
memberMukund Thakker22-Feb-12 17:44 
GeneralYes that is another solution but I disagree that you should ... Pin
FrostedSyntax21-Feb-12 19:21
memberFrostedSyntax21-Feb-12 19:21 
Yes that is another solution but I disagree that you should ALWAYS avoid relative paths.
GeneralReason for my vote of 1 maybe a solution could be ALWAYS AVO... Pin
giammin21-Feb-12 2:56
membergiammin21-Feb-12 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150723.1 | Last Updated 20 Feb 2012
Article Copyright 2012 by FrostedSyntax
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid