我有两张图片,一张附在 HTML(背景)标签上,位于底部、左侧和重复 X。 我在 body 标签上附加了另一个背景图片,它位于左上角并重复 X。
我注意到 Body 覆盖了 html 图像。我不确定这是否可行,我尝试搜索但没有解决方案。
有没有办法让正文图片停留在html图片下面?
这样 html(附加到背景的图像)位于主体(背景)图像之上?
html {
background-repeat: repeat-x;
background-position: left bottom;
background-image: url(../graphics/main-background-image-x.png);
}
body {
background-repeat: repeat-x;
background-position: left top;
background-image: url(../graphics/sub-background-image-x.png);
}
最佳答案
本站here通过将 height: 100%;
添加到 body 和 html 标签,实现了我认为您正在寻找的东西。
html{
background-repeat: repeat-x;
background-position: left bottom;
background-image: url(../graphics/main-background-image-x.png);
height: 100%;
}
body{
background-repeat: repeat-x;
background-position: left top;
background-image: url(../graphics/sub-background-image-x.png);
height: 100%;
}
关于css - 为什么正文背景图片覆盖了 HTML 标签背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6011713/