gpt4 book ai didi

html - 无法使我的网站响应

转载 作者:太空宇宙 更新时间:2023-11-04 05:39:55 24 4
gpt4 key购买 nike

我目前正在尝试使我的网站具有响应性,即图像随着页面大小的调整而放大和缩小,内容堆叠在彼此之上等。我的印象是我已经采取了适当的步骤,但元素仍在延伸调整大小时的大小,并且内容不在其原始位置。

如何在保持所有元素完好无损的情况下实现这一结果?

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
background-image: url(img/food-background.jpg);
background-attachment: fixed;
height: 100%;
}

.main-content {
display: flex;
flex-wrap: wrap;
}

.container {
margin-left: auto;
margin-right: auto;
width: 1140px;
}

.Navbar {
text-align: center;
display: block;
margin-top: 2%;
}

#center-logo {
width: 100%;
max-width: 200px;
height: auto;
text-align: center;
}

#Navbar_Link-Toggle {
display: none;
}

img {
width: 40%;
}

.links {
text-decoration: none;
font-size: 13px;
color: black;
font-weight: bold;
padding: 25px;
}

.links:hover {
color: #f58300
}

a:visited {
color: black;
}

.header {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-top: 3%;
height: auto;
background-color: yellow;
}

#food {
height: 65vh;
width: 100%
}

.footer {
margin-top: 100%;
bottom: 0;
width: 100%;
text-align: center;
font-size: 10px;
margin-left: auto;
margin-right: auto;
background-color: #f7f7f7;
}

.top {
float: left;
width: 100%;
}

#olive-green {
margin-top: 5%;
position: absolute;
right: 50px;
max-width: 450px;
}

#coral {
max-width: 450px;
position: absolute;
left: 50px;
margin-top: 5%;
}

#teal {
max-width: 450px;
position: absolute;
left: 50px;
margin-top: 50%;
}

#honey {
margin-top: 50%;
position: absolute;
right: 50px;
max-width: 450px;
}

.images {
content: "";
clear: both;
display: table;
}

@media screen and (max-width: 900px) {
.top {
width: 100%;
}
.bottom {
width: 100%;
}
}
<div class='main-content'></div>

<div id='Navbar_Link-Toggle' style='font-size: 20px'>

<i id='main' class='fas fa-bars'></i>

</div>

<div class='container'>

<div class='Navbar'>

<a class='links' href=''>FOOD</a>

<a class='links' href=''>FUN</a>

<img id='center-logo' src='img/SAMO.png'>

<a class='links' href=''>HISTORY</a>

<a class='links' href=''>LOCATION</a>

</div>

</div>

<div class='header'>

<img id='food' src='img/food.jpg'>

</div>

<div class='images'>

<div class='top'>

<img id='coral' src='img/coral.png'>

<img id='olive-green' src='img/olive-green.jpg'>

</div>

<div class='middle'>

<img id='teal' src='img/teal.jpg'>

<img id='honey' src='img/honey.jpg'>

</div>

</div>

</div>

<div class='footer'>

<p>200 Santa Monica Pier, Suite A Santa Monica, CA 90401</p><br>

<p>Questions? Drop us a message at: info@santamonicapier.org or 310-458-8900</p><br>

<p>All Rights Reserved © 2019 Santa Monica Pier</p>

</div>

最佳答案

您在 HTML 的第一行有一个额外的结束 div。因此,您的 .main-content 元素实际上会立即关闭,而不是环绕其余元素。

关于html - 无法使我的网站响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59311345/

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