Search code examples
cssasp.netbackground-imagemaster-pagescontentplaceholder

Image in body of Child page ContentPlaceHolder


I have a Master Page with 2 different child pages.

One if the child pages i would like to put an background image in. This almost works however the image does not appear in the ContentPlaceHolder it rather appears on the body.

<%@ Page Title="" Language="C#" MasterPageFile="~/BiPlanning.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

     <style type="text/css">

body  {
    background-image:url('tmp.jpg');
    <%-- background-size:2px;     <-THIS DOES NOT WORK --%>
}        

   </style>

</asp:Content>

I understand what i'm doing wrong however how can i either size my image so it does not cover the whole body of the child page OR how do i put the actul image in the ContentPlaceHolder?


Solution

  • For it to work i created a DIV tag within my contantplaceholder and changed the width, height etc...

    <div width="120" height="100" style="vertical-align:middle; text-align:center" >
            <img src="tmp.jpg" />
        </div>