我试图在 div 的背景中设置图像但消失了!我想要背景图片覆盖所有页面,谢谢。
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
div {
width:100%;
height: 100%;
background-image: url('https://static.vecteezy.com/system/resources/previews/000/094/491/original/polygonal-texture-background-vector.jpg');
}
</style>
</head>
<body>
<div></div>
</body>
</html>
最佳答案
只需将它直接贴在 body 上即可:
body {
background-image: url("img_link");
}
希望这对您有所帮助。
关于html - 如何将背景设置为div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39679147/