HTML如何让Body的背景图覆盖整个页面

2025-04-13 17:28:38
推荐回答(2个)
回答1:

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的标签中,新增样式代码:background-image: url(image.jpg);background-size: 100%。

3、浏览器运行index.html页面,此时body的背景图片整个覆盖了页面,没有白框。

回答2:

body{
  background:#fff url() no-repeat left top;
  background-size:100%;
}
这样就可以了,不可以的话请追问。