【发布时间】:2014-11-04 15:17:10
【问题描述】:
我正在尝试在 CSS 中设置背景图像以适应屏幕。它在最新版本的 Chrome 上运行良好,但是,我遇到了 IE 10 的问题。
html {
border-top: 10px solid #8A85A5;
background: url("http://www.lifeintempe.com/gfx/photos/2008-11-28-tempe-sunset-56632.jpg") no-repeat center center fixed ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
这就是它在 IE 10 中的显示方式。有太多的空白...
关于如何解决此问题的任何建议?
我也尝试添加...没有用。
min-height:100%;
min-width: 100%;
更新:
以上是我的 CSS 文件中的所有内容。这是我的html 的样子:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="ScreenPop.Site" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel ="stylesheet" type ="text/css" href="Style/MyStyle.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</form>
</body>
</html>
【问题讨论】:
-
您是否尝试过在您的 css 中将
html更改为body? -
Chrome 只是在拉伸您的图像吗?无论哪种方式,您是否尝试过设置 width:100% ?
-
@imtherman,是的,我有。结果相同。
-
你声明了什么
doctype? -
jsfiddle.net/69evLca1/3 在 IE10 中为我工作。尝试设置
height: 100%;和width: 100%;。因为HTML没有固有高度(它从视口继承)。
标签: css asp.net internet-explorer-10