gpt4 book ai didi

html - 两个div之间的间距问题

转载 作者:太空宇宙 更新时间:2023-11-03 21:23:56 27 4
gpt4 key购买 nike

我在媒体查询中的两个同级 div 之间存在间距问题。我无法弄清楚为什么会有间距。我的 white-green div 应该触及 arrow-box div 的底部,但由于某种原因,white-green div 似乎是从 project-input-container 中获取 top: 100px; 的效果。

有人知道为什么会这样吗?

这是它的样子:

enter image description here

我的 HTML

<div class="arrow_box">
<div id="project-content-wrap">
<div id="project-box-title1">KICK START YOUR</div>
<div id="project-box-title2">PROJECT</div>
<div id="project-box-description">We enjoy partnering with established brands from all over the globe. To begin the process please provide us with a high level overview and submit our form. We will review and respond promptly.</div>
</div>
</div>

<div class="white-green">
<form action="" autocomplete="on" class="project-input-container">
<input type="text" class="input-borderless" placeholder="Your Name">
<input type="text" class="input-borderless" placeholder="Title/Role">
<input type="email" class="input-borderless" placeholder="Email Address">
<input type="text" class="input-borderless" placeholder="Phone Number">
<input type="text" class="input-borderless" placeholder="Company/URL">
<input type="text" class="input-borderless" placeholder="How did you hear about us?">
<input type="text" class="input-borderless" placeholder="Which of our social media influenced you the most?">
<input type="text" class="input-borderless" placeholder="Human Test: What day comess after Thursday?">
</form>
</div>

我的普通桌面代码是这样的:

.arrow_box {
position: relative;
background-color: rgb(69,186,149);
border: 4px solid rgb(69,186,149);
width: 33%;
height: 800px;
z-index: 99;
}
.arrow_box:after, .arrow_box:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}

.arrow_box:after {
border-color: rgba(255, 0, 0, 0);
border-left-color: rgb(69,186,149);
border-width: 40px;
margin-top: -40px;
}
.arrow_box:before {
border-color: rgba(0, 0, 0, 0);
border-left-color: rgb(69,186,149);
border-width: 26px;
margin-top: -26px;
}
#project-content-wrap {
margin: 30% 15%;
}
#project-box-title1 {
font-size: 1.3em;
color: #FFF;
}
#project-box-title2 {
font-size: 6.2em;
color: #FFF;
margin-top: 20px;
}
#project-box-description {
font-size: 1.3em;
color: #303030;
margin-top: 50px;
line-height: 1.6em;
}
/*-----Input div on project page----*/
.white-green {
background-color: rgb(241,250,247);
width: 66.56%;
height: 100%;
margin-left: 33%;
margin-right: 0;
position: absolute;
top: 0;
right: 0;
}
.project-input-container {
margin-top: 160px;
margin-left: 9%;

}
.input-borderless {
width: 80%;
border-top: 0px;
border-bottom: 1px solid green;
border-right: 0px;
border-left: 0px;
background-color: rgb(241,250,247);
text-decoration: none;
outline: none;
display: block;
padding: 10px 0;
margin: 20px 0;
font-size: 1.6em;
}

媒体查询:

@media screen and (max-width:640px) {
.arrow_box {
width: 100%;
height: 400px;
}
.arrow_box:after, .arrow_box:before {
top: 100%;
left: 50%;
}

.arrow_box:after {
border-color: rgba(136, 183, 213, 0);
border-top-color: rgb(69,186,149);
border-width: 30px;
margin-left: -30px;
}
.arrow_box:before {
border-color: rgba(194, 225, 245, 0);
border-top-color: rgb(69,186,149);
border-width: 36px;
margin-left: -36px;
margin-top: 0;
}
#project-content-wrap {
margin: 10% 5%;
}
#project-box-title1 {
font-size: 1.1em;
color: #FFF;
}
#project-box-title2 {
font-size: 3.2em;
color: #FFF;
margin-top: 20px;
}
#project-box-description {
font-size: 1.1em;
color: #303030;
margin-top: 40px;
line-height: 1.6em;
}
/*-----Input div on project page----*/
.white-green {
background-color: rgb(241,250,247);
width: 100%;
height: auto;
/*margin-top: -30px;*/
margin-left: 0;
margin-right: 0;
margin-bottom: 0;
position: relative;
right: 0;
top: 0;
}
.project-input-container {
top: 100px;
left: 3%;
position: relative;
}
.input-borderless {
width: 90%;
border-top: 0px;
border-bottom: 1px solid green;
border-right: 0px;
border-left: 0px;
background-color: rgb(241,250,247);
text-decoration: none;
outline: none;
display: block;
padding: 10px 0;
margin: 20px 0;
font-size: 1.2em;
}
}

最佳答案

减少以下标记规则的值并查看。

.project-input-container {
top: 100px; /*this*/
left: 3%;
position: relative;
}

.project-input-container {
margin-top: 160px; /*this*/
margin-left: 9%;
}

关于html - 两个div之间的间距问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34799039/

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