html - 如何让背景拉伸(stretch)到全宽?

标签 html css

我必须通过 HTML 页面的背景来修复全宽,但背景的高度与我的设计不符。我该如何解决?

CSS 代码:

html {
    background: url(images/body_bg.jpg') no-repeat top left fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

最佳答案

您在 url 中缺少一个 '

background: url('images/body_bg.jpg') no-repeat top left fixed;

Demo

关于html - 如何让背景拉伸(stretch)到全宽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21899051/

相关文章:

html - 如果图像已加载或是否正在显示,如何使用 css 检查?

用于链接格式的 CSS 语法

javascript - 单击图像的一部分重定向到许多网址

jquery - 如何使用 jQuery 添加 !important css 属性?

html - 向右浮动垂直对齐

javascript - 鼠标移动时出现,静止时消失的导航栏

javascript - 一次显示一个div

JavaScript + HTML : Button Not Calling on Function Onclick

jQuery .animate() 在 Chrome 中跳转

javascript - 哪些 CSS 文件会影响网页?