gpt4 book ai didi

html - 在窗口调整大小时,信息旁边 float 到左侧的 div 下降

转载 作者:行者123 更新时间:2023-11-28 01:39:43 26 4
gpt4 key购买 nike

我正在制作一个模拟网站,在窗口从其位于 .info 右侧的原始位置稍微调整大小后,.sidebar div 移动到 .info div 下方。我试图确保侧边栏保持原样,即使窗口的大小被调整为小于它但它不起作用。任何帮助将不胜感激,这是代码。

    <!DOCTYPE html>
<html>
<head>
<title>Sushi Restaurant</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>

<header>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Location</a></li>
<li><a href="#">Contact</a></li>
</ul>

</header>

<div class="info">
<p>Food, in the end, in our own tradition, is something holy. <br>It's not about nutrients and calories.<br>
It's about sharing. <br>It's about honesty. <br>It's about identity.</p>
<img src = "MomoSushi.jpg">
</div>
<div class ="sidebar">
<img src = "download.png">
<p>265 Rock Rd, Condville DR 8182 9237</p>
<h3>Opening Hours</h3>
<ul>
<li>Monday-9AM to 9PM</li>
<li>Tuesday-9AM to 9PM</li>
<li>Wednesday-9AM to 9PM</li>
<li>Thursday-9AM to 9PM</li>
<li>Friday-9AM to 9PM</li>

</ul>
</div>
</body>
</html>

* {
margin:auto;
}
body {
font: bold 1.1em Courier;
max-width:1600px;
min-width:1000px;
margin:auto;
}

header ul li{
width:17%;
min-width:18%;
margin-top:4px;
float:left;
margin-right:15px;
list-style-type:none;
border: 1px solid lightgrey;
padding:15px 20px 5px;
border-radius:0 0 15px 15px ;
text-align:center;
box-shadow: 0px 10px 5px #F5F5F5 inset;
}
ul {
padding-left:0;

}
header {
margin:auto;
}
a {
text-decoration:none;
color: #888888;
}
.info {

min-width:60%;

margin-top:30px;
height:800px;
float:left;
margin-left:0;
padding:left:0;
background-color: #E8E8E8;


}
.info p {
width: 30%;
float:left;
line-height:3em;
margin-top:50px;
margin-left:100px;

}
.info img {
position:fixed;
float:right;
width:200px;
height:200px;
margin-top:60px;

margin-left: 150px;
border-radius:50%;

}



.sidebar {
min-width:30%;
margin-left:5px;
float:left;
position:relative;


}

.sidebar li {
display:block;
margin-left:70px;
}

.sidebar h3 {
margin-left:80px;
}

.sidebar p {
margin-top:1px;
margin-left:10px;
margin-bottom:2px;

}

最佳答案

发生这种情况是因为您提供了BODY TAGmin-width:1000px; 尝试将其增加到 min-width:1400px;

您不希望它具有响应性吗?如果是,您肯定需要更改 HTML 的结构

关于html - 在窗口调整大小时,信息旁边 float 到左侧的 div 下降,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50478714/

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