gpt4 book ai didi

html - DIV 的高度差异

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

我有一个主部门,其中有两个部门

一个是左DIV,一个是右DIV

Fiddle Here

HTML 是

<div class="main">

<div class="left">
Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text. Lorem Ipsum is a dummy text.
</div>
<div class="right">
some text heresome text heresome text heresome text heresome text heresome text heresome text heresome text heresome text here
</div
</div>

CSS 是

body
{
background-color:black;
}
.main
{
width:80%;
background-color:White;
opacity:0.9;
margin-left:auto;
margin-right:auto;
margin-top:25px;
}
.left
{
width:68%;
float:left;
background-color:White;
padding:2%;
font-family:Calibri;
}

.right
{
background-color:White;
width:26%;
padding:1%;
float:right;
}

我希望两个 DIV 必须始终具有相同的高度。无论其中有多少文本。

现在我的右边 DIV 的高度小于左边的 DIV,就像 fiddle 一样。

帮帮我。提前致谢

最佳答案

将其添加到 .main

height: 30%;
overflow: auto;

链接:Fiddle Example

关于html - DIV 的高度差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14519124/

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