gpt4 book ai didi

html - 由于右侧 Div 上的文本,左侧 Div 的高度不均匀,寻找 html/css 修复

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

我有这个布局。正如图片中所解释的那样,我希望左框跟随右框的高度,右框的高度会随着我在文章中放置的文本而改变(澄清一下,由于文本的原因,右侧可以改变高度)。如果可能,我只想使用 HTML/CSS 进行修复。 enter image description here

HTML简化代码

#left {
width: 15%;
min-height: 800px;
}
#right {
width: 85%;
min-height: 800px;
}
<body>
<div id="left">this is div1</div>
<div id="right">
<p>Also has a bunch of text here which makes the div go uneven with the left</p>
</div>
</body>

最佳答案

<style>
.left {
float:left;
width: 15%;
/*min-height: 800px;*/
background-color: green;
height:100%;
}
.right {
width: 85%;
/*min-height: 800px;*/
height:100%;
background-color: red;


}
.wrap {

min-height: 800px;

}
</style>
<div class="wrap">
<div class="left"></div>
<div class="right"></div>
</div>

关于html - 由于右侧 Div 上的文本,左侧 Div 的高度不均匀,寻找 html/css 修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39439340/

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