CodePudding user response:
1, no combined with the former code is such,& lt; ! DOCTYPE html>
<meta charset="utf-8" & gt;
<style>
Div {
Width: 1024 px;
Height: 768 px;
border: 1px solid red;
}
# div1 {
Background - image: url (imgs/which wallpaper - 1. JPG); 1024 x768 *//* background size
Background - repeat: no - repeat;
}
</style>
<body>
Running effect is like this:CodePudding user response:
2, add the background - attachment: fixed; Style, the background becomes width and height are blank,CodePudding user response:
Browser f12debugger see may be the div inherited padding