【问题标题】:Background fixed & cover - Internet explorer 11背景固定和封面 - Internet Explorer 11
【发布时间】:2014-02-12 08:03:43
【问题描述】:

http://apolytos.com/new/img/test.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
    background:url("background.jpg");
    background-repeat:no-repeat;
    background-attachment:fixed;
    background-size: cover;
    background-position:top center;
    margin:0;
}
</style>
</head>
<body>
</body>
</html>

Internet Explorer 11 未覆盖;查看提供的链接。如果我删除 :fixed,它会按预期覆盖,但是 bg 会滚动页面上不需要的内容。 IE中的这两行代码似乎有冲突。

【问题讨论】:

  • 哟,你有 jsfiddle 吗?
  • 负有ghostrider

标签: css internet-explorer-11 background-attachment


【解决方案1】:

试试这个代码,它应该可以正常工作。

html { 
  background: url(images/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

【讨论】:

【解决方案2】:

尽量使用背景图片作为替换元素,即作为标签使用

【讨论】:

  • 你能举个例子吗?我没有完全关注
  • 试着把lyk 和.img{ position:absolute;顶部:0;宽度:100%;高度:100%;}
猜你喜欢
  • 2014-07-06
  • 2011-08-19
  • 2014-06-01
  • 1970-01-01
  • 2014-05-27
  • 2014-12-01
  • 2023-03-07
  • 2017-06-27
  • 1970-01-01
相关资源
最近更新 更多