gpt4 book ai didi

html - 为什么清除 :both? 不起作用

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

在这里,我期望 count 向下移动到每个 *ID 类之下,但它并没有发生。每个*ID和它对应的count在同一行。我该如何解决这个问题,为什么它没有被清除?

<div class="statusInfo">
<div class="Scribbles">
<div class="ScribblesID">Scribbles</div>
<div class="count">100</div>
</div>
<div class="Following">
<div class="FollowingID">Following</div>
<div class="count">100</div>
</div>

<div class="Followers">
<div class="FollowersID">Followers</div>
<div class="count">100</div>
</div>
</div>

CSS

.statusInfo {
position: absolute;
bottom: 30px;
}
.Scribbles {
float: left;
}
.Following {
float: left;
}
.Followers {
float: left;
}
.ScribblesID {
display: inline-block;
float: left;
}
.FollowingID {
display: inline-block;
float: left;
}
.FollowersID {
display: inline-block;
float: left;
}
.count {
display: inline-block;
clear: both;
}

最佳答案

clear 属性仅适用于 block 级元素。您正在使用内联 block ,clear:both; 不适用于此。

https://developer.mozilla.org/en-US/docs/Web/CSS/clear

关于html - 为什么清除 :both? 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37900679/

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