我不知道如何使 html 和 css 中的背景图像填充在导航栏和页脚下方。当我滚动导航栏的空间只是一个空白时,我希望它滚动时顶部和底部没有空间。谢谢!
* {
box-sizing: border-box;
}
body, html {
margin: 0 auto;
padding: 0;
}
.background-container {
background-image: url("http://placekitten.com/g/500/500");
background-size: cover;
background-position: center;
position: fixed;
width: 100%;
height: 100%;
opacity: 0.5;
z-index: -1;
background-repeat: no-repeat;
}
.logo-container {
display: flex;
justify-content: center;
align-items: center;
height: 30%; /* Adjust the height as needed */
}
.logo-container img{
max-width: auto;
max-height: 600px;
text-align: center;
}
@media screen and (max-width: 768px) {
/* Adjust background image for mobile devices */
.background-container {
background-position: center;
height: auto;
}
}
.footer {
padding: 25px 0;
background-color: #f2f2f2;
bottom: 0;
width: 100%;
}
.navbar {
margin-bottom: 0;
border-radius: 0;
margin: 0;
padding: 0;
width: 100%;
overflow: auto;
}
@media (max-width: 768px) {
.logo-container {
margin-top: 50px;
}
.footer {
position: relative;
}
.navbar {
position: relative;
}
我尝试更改 css 和 html 上的代码,但似乎没有任何改变结果。
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号