gpt4 book ai didi

html - Css 代码为什么 div 类会下降?

转载 作者:太空宇宙 更新时间:2023-11-04 11:38:02 25 4
gpt4 key购买 nike

我已经发布了问题..但没有人回答问题..我的代码是:

* {
margin: 0;
padding: 0;
}

body {
width: 100%;
font-family: 'Cabin', sans-serif;
background-color: #333;
}

.firstnav {
margin:auto;
height: 1500px;
display: block;
width: 70%;
-webkit-flex: 3 1 60%;
flex: 3 1 60%;
-webkit-order: 2;
order: 2;
}

#third {
background: #f00;
position:relative;
display:inline-block;
width: 30%;
margin-left:auto;
margin-right:auto;
height: 500px;
-webkit-flex: 1 6 20%;
flex: 1 6 20%;
-webkit-order: 3;
order: 3;
}

#second {
background: #fff;
position:relative;
display:inline-block;
margin-left:auto;
margin-right:auto;
width: 67%;
height: 1500px;

-webkit-flex: 1 6 20%;
flex: 1 6 20%;
-webkit-order: 3;
order: 3;
}

#registration-form {
font-family:'Open Sans Condensed', sans-serif;
width: 100%;
margin: 20px auto;
position: relative;
display:block;
position:absolute;
}

#registration-form .fieldset {
background-color:#d5d5d5;

border-radius: 3px;

}

#registration-form legend {
text-align: center;
background: #364351;
width: 100%;
padding: 30px 0;
border-radius: 3px 3px 0 0;
color: white;
font-size:2em;
}

.fieldset form{
border:1px solid #2f2f2f;
margin:0 auto;
display:block;
width:100%;
padding:30px 20px;
box-sizing:border-box;
border-radius:0 0 3px 3px;
}
<div class="firstnav">

<div id="second"><p>second<p></div>
<div id="third">

<div id="registration-form">
<div class='fieldset'>
<legend>Todays news
</legend>
<form action="#" method="post" data-validate="parsley">

</form>
</div>
</div>

</div>

在这里,你可以看到第二个内容正在下降..为什么会这样?我想要两个容器并排..我已经更改了“#second”代码但它仍然没有到一边..

最佳答案

好像少了一行。元素没有 float 。尝试将 float: left; 添加到 #second

在 JSFiddle 上使用它。我已经为你做了改变。那是你要找的吗? https://jsfiddle.net/jr0gpaqg/

关于html - Css 代码为什么 div 类会下降?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31589667/

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