子页面ContentPlaceHolder正文中的图像

时间:2018-04-20 12:15:19

标签: css asp.net background-image master-pages contentplaceholder

我有一个包含2个不同子页面的母版页。

如果子页面我想要放入背景图像。 这个几乎但是图像没有出现在 ContentPlaceHolder 中,而是显示在正文上。

<%@ 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>

我理解我做错了但是我如何调整图像大小以使其不覆盖子页面的整个主体我如何将actul图像放入的的ContentPlaceHolder

1 个答案:

答案 0 :(得分:0)

为了它的工作,我在我的contantplaceholder中创建了一个DIV标签,并改变了宽度,高度等......

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