我正在创建视差背景,但背景图像没有覆盖整个屏幕 谁能告诉我如何解决它?这就是我所拥有的视差..
<style>
.parallax {
/* The image used */
background-image: url("rocket-2680282_1920 (1).jpg");
/* Set a specific height */
height: 1078px;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: initial;
background-repeat: no-repeat;
background-size: cover;
}
</style>
如果你想明白我的意思,这里是网站link
最佳答案
看起来你的 body
有一个 margin
尝试将它添加到你的 css 中:
body{
margin:0px;
}
关于html - 如何在html中创建一个视差网站(为什么我的背景图像不会覆盖整个屏幕?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47243253/