我遇到了问题,这让我疯了。简而言之,我已经在朴素HTML / CSS中本地测试了subj中的方法,它完美地运行:
<html style="
padding:0px;
border:0px;
margin:0px">
<body style="padding:0px;border:0px;margin:0px;">
<form style="width:100%;height:100%;padding:0px;border:0px;margin:0px;background: url(background.jpg) no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background.jpg', sizingMethod='scale');
-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='background.jpg', sizingMethod='scale');">
<div style="float:right;width:500px;height:100%;background-color:#ffffff;padding:0px;border:0px;margin:0px;"></div>
</form>
</body>
</html>
但是试图将它放在ASP.Net中完全失败了,因为图像没有调整大小但显示出内在大小。
<body>
<form id="MainForm" runat="server" style="height:100%;width:100%">
<div class="MainArea" runat="server">
<div class="Header">
<asp:Label ID="PageTitleLabel" runat="server"></asp:Label>
</div>
<%
string logoPath =
System.Web.Configuration.WebConfigurationManager.AppSettings[ "logo" ];
if( !String.IsNullOrEmpty( logoPath ) )
{
%>
<div class="GroupXLargeMargin">
<img src="<%= logoPath %>" alt="logo" />
</div>
<%
}
%>
<div class="GroupLargeMargin">
<div class="TextSizeXLarge">
<asp:Label ID="STSLabel" runat="server"></asp:Label>
</div>
</div>
<div class="MainActionContainer">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</body>
和CSS:
*
{
margin: 0px;
}
html, body
{
width: 100%;
height: 100%;
padding: 0px;
}
body
{
font-size: 0.8em;
font-weight: normal;
font-family: "Segoe UI", Verdana, Tahoma, Arial, sans-serif;
background-color: #ff5500;
color: #222222;
background: url(../App_Themes/Default/background.jpg) no-repeat;
background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../App_Themes/Default/background.jpg', sizingMethod='scale');
-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../App_Themes/Default/background.jpg', sizingMethod='scale');
}
我认为没有理由不工作,但事实并非如此。如果重要,ASP页面是ADFS登录母版页。我已经尝试将背景应用于各种元素,并且它始终是相同的 - 在HTML中工作,而不是在ASP.Net中。
答案 0 :(得分:0)
<meta http-equiv="X-UA-Compatible" content="IE=8" />
评论出来并且一切正常。 也许那将成为某人的捷径。