gpt4 book ai didi

html - 如何在html中创建一个视差网站(为什么我的背景图像不会覆盖整个屏幕?)

转载 作者:太空宇宙 更新时间:2023-11-04 01:30:23 25 4
gpt4 key购买 nike

我正在创建视差背景,但背景图像没有覆盖整个屏幕 谁能告诉我如何解决它?这就是我所拥有的视差..

    <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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com