在这里,我期望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属性仅适用于块级元素。您使用的是内联块,clear:both;不适用于该块。

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

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

10-13 01:08