65.9K
CodeProject is changing. Read more.
Home

Relative Path Solution for Master Pages

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.67/5 (4 votes)

Feb 20, 2012

CPOL
viewsIcon

20322

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.