gpt4 book ai didi

css - 当左列 div 大于右列 div 时,div 重叠

转载 作者:行者123 更新时间:2023-11-28 11:47:38 26 4
gpt4 key购买 nike

我在一个页面上创建多个 3 列 div。我注意到如果左列 div (data_cell1) 比右列 div (data_cell3) 长。下面的 div 向上进入上面的 div 并与之重叠。

我需要在我的 css 中更改什么以允许在每个 div 包装器之间进行分隔?

如果左列div和右列div的大小相同,那么我就没有这个问题。

这是代码示例: http://jsfiddle.net/huskydawgs/UMf3k/77/

      <div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="data_cell2">

</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
</div>
</div>
</div>

<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
<div class="data_cell2">

</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
</div>
</div>


<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
<div class="data_cell2">

</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
</div>
</div>

最佳答案

由于您在某些元素上使用了float,因此您需要clear 才能让父元素占据完整的高度,我使用了这种技术:

.data_row:after {
content:" ";
display:block;
clear:both;
}

你可以看到更多关于这个here和你的演示 here

关于css - 当左列 div 大于右列 div 时,div 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20433461/

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