html - 如何在 Chrome 中设置背景图片?

标签 html css internet-explorer google-chrome background-image

如何使用 CSS 和 HTML 设置可在 Chrome 中使用的背景图片?以下代码在 IE 中有效,但在 Chrome 中无效?

body 
{
    background-repeat: no-repeat;
    background-color: transparent;
    background-image: URL("\Backgrounds\bg.jpg");
}

最佳答案

这段代码有效!!

body {
        background: url("../img/img_bg.jpg") no-repeat center center fixed;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;
        width: 100%;
        height: 100%;
}

关于html - 如何在 Chrome 中设置背景图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24568343/

相关文章:

css - 阴影文本 : CSS or graphic?

css - first-child & last-child 跨浏览器兼容性

html - 谁是 Internet Explorer <= 8 的主要用户?

javascript - AngularJS 过滤器;将数字格式化为字符串,反之亦然?

html - 如何实现网页之间的平滑过渡?

html - CSS,图像上的悬停框仅出现在一张图像上

html - 防止填充使元素变大?

javascript - IE11 不能很好地处理 Blob 构造函数和 javascript 数组

html - 在桌面和移动 View 上重新排序 Bootstrap 列

javascript - 使用 Javascript 阻止 Android 后退按钮