首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >背景固定和封面- Internet explorer 11

背景固定和封面- Internet explorer 11
EN

Stack Overflow用户
提问于 2014-02-12 16:03:44
回答 2查看 7.2K关注 0票数 1

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

代码语言:javascript
复制
<!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中的这两行代码似乎有冲突。

EN

回答 2

Stack Overflow用户

发布于 2014-02-12 16:07:55

试一试这段代码,它应该可以很好地工作。

代码语言:javascript
复制
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;
}
票数 0
EN

Stack Overflow用户

发布于 2014-02-12 16:09:25

尝试使用背景图像作为替换元素,这意味着使用标签

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21721980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档