Click here to Skip to main content
Click here to Skip to main content

Relative Path Solution for Master Pages

, 20 Feb 2012 CPOL
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
Web Developer JBH Works
United States United States
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 1 This will not work in url rewrite pa... PinmemberMukund Thakker22-Feb-12 18:46 
GeneralYou can use the full url, if you have url rewrite. &lt;link ... PinmemberMukund Thakker22-Feb-12 18:44 
GeneralYes that is another solution but I disagree that you should ... PinmemberFrostedSyntax21-Feb-12 20: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... Pinmembergiammin21-Feb-12 3: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
Web04 | 2.8.141216.1 | Last Updated 20 Feb 2012
Article Copyright 2012 by FrostedSyntax
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid