css - body 上有 2 个背景 : how to set the height for the backgrounds

标签 css background

我有这个代码:

body{
    margin: 0px;
    padding: 0px;
    background-image: url(images/header.png), url(images/footer.png);
    background-repeat: repeat-x, repeat;
    background-height: 50px , 400px; /* ?? */
    background-position: 0% 0%, 0% 100%;

}

我可以给 footer.png 一个高度,该高度会在那个特定高度重复吗?

最佳答案

你可以试试background-size:

body{
    margin: 0px;
    padding: 0px;
    background-image: url(images/header.png), url(images/footer.png);
    background-repeat: repeat-x, repeat-x;
    background-size: auto, auto 500px; // here give to background images height
    background-position: 0% 0%, 0% 100%;


}

关于 background-size 的更多信息 is here .

关于css - body 上有 2 个背景 : how to set the height for the backgrounds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13525382/

相关文章:

javascript - IE 和 Chrome 中的 Div 定位和 css 样式更改

ios - 在 IOS 中查看过渡 [想要更改背景]

CSS 背景颜色分层渐变

jquery - IE 10 不显示模式。似乎是 jQuery 1.7.1 的动画问题

html - 欢迎页面背景

javascript - css 背景在 div 中不起作用

css - css中背景图像的url属性

html - 如何使某种文本样式变大?

html - 溢出隐藏的div

html - 如何使 3 列嵌套列表只有内部装订线(没有外部边距)?