Monday, April 13, 2009

ASP.NET MVC Masterpage Image

I had a problem trying to figure out a way to display an image on a master page and have that image display on all child pages.

I could get it to show the image on all child pages in the IDE, but when I would publish, the image would not show.

My problem was fixed by creating a "class" in my Site.css file.
You can put this code anywhere in that file, but it would be good practice to group classes by logical function.

/*
SAMPLE
*/
.photo-container
{
padding:10px;
border:1px dotted #7a7a7a;
}

To display the image in the master page, this code worked for me.

Make a "div", make the "div" "class='photo-container'". style="width:auto;"> "img src="../../[Folder]/ [File].jpg" />

Type the code where you want your image to be. I hope this helps.

No comments:

Post a Comment