gpt4 book ai didi

html - 我怎样才能使 div 与其他 div 相邻,但像屏幕截图中那样将它们保持在原位

转载 作者:行者123 更新时间:2023-11-28 07:45:09 30 4
gpt4 key购买 nike

正如我在标题中解释的所有内容,然后我将只为你们提供我现在拥有的代码,我一直在努力实现我想要的东西很长时间但没有运气......它表现得像响应式的,但即使调整大小我也想将其保持在原位...截图enter image description here

<!DOCTYPE html>
<html>
<head>
<title>
Home
</title>

<style>
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 20px 50px 150px;
margin: 0 0 0 0;
font-size: 13px;
text-align: center;
}
#content1{
//float: left;
width: 300px;
height: 740px;
margin-left: 50px;
}
#content2{
//float: right;
margin-right: 50px;
width: 300px;
height: 300px;
}
#content3{
width: 740px;
height: 740px;
}
.content{
margin: 20px 100px auto auto;
display: inline-block;
background-color: #F0F0F0;
}
#navbar{
margin: 10px auto auto auto;
min-width: 120px;
min-height: 120px;
}
#navbar-menu{

}
#navbar-menu ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
#navbar-menu ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#navbar-menu ul li:hover {
background: #555;
color: #fff;
}
#navbar-menu ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
#navbar-menu ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
#navbar-menu ul li ul li:hover { background: #666; }
#navbar-menu ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
#navbar-menu ul li.active {
background: #555;
color: #fff;
}
</style>
</head>

<body background="../images/bg.png">
<div id="navbar">
<div id="navbar-menu">
<ul><li class="active">Home</li>
<li>About</li>
<li>
Projects
<ul>
<li>Web Design</li>
<li>Web Development</li>
</ul>
</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
</div>
<div id="content1" class="content">
<h1>ey</h1>
</div>
<div id="content2" class="content">
<h2>eye</h2>
</div>
<div id="content3" class="content">
<h3>eyey</h3>
</div>
</body>
</html>

最佳答案

我已经修改了你的一些 CSS 代码:

CSS:更新

#content1{
width: 20%;
height: 740px;
}
#content2{
width: 20%;
height: 300px;
}
#content3{
width: 40%;
height: 740px;
}
.content{
margin-top:20px;
margin-left:5%;
display: inline-block;
float:left;
background-color: #F0F0F0;
}

将上面的代码替换为您的样式。

关于html - 我怎样才能使 div 与其他 div 相邻,但像屏幕截图中那样将它们保持在原位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30737212/

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