Click here to Skip to main content
13,552,926 members
Click here to Skip to main content
Add your own
alternative version


Posted 20 Feb 2012
Licenced CPOL

Relative Path Solution for Master Pages

, 20 Feb 2012
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.


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


About the Author

Web Developer JBHworks
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 
GeneralReason for my vote of 1 maybe a solution could be ALWAYS AVO... Pin
giammin21-Feb-12 2:56
membergiammin21-Feb-12 2:56 
Reason for my vote of 1
maybe a solution could be ALWAYS AVOID relative path....

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180515.1 | Last Updated 20 Feb 2012
Article Copyright 2012 by FrostedSyntax
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid