ul漂浮在父div底部边框上方

问题描述 投票:0回答:1

无序列表浮动在其“父div”的底部边框上。我不明白为什么会发生这种情况,并且只找到解决问题的方法。

enter image description here

当我增加父div(红色边框)的高度时,ul将保持在完全相同的位置。

.bottom-container .comment-list .comment .buttons {
  width: 100%;
  height: 25px;
  border: 1px solid red;
}

.bottom-container .comment-list .comment .buttons #comment-details {
  float: right;
  display: inline-block;
  list-style-type: none;
  margin-right: 10px;
}

.bottom-container .comment-list .comment .buttons #comment-details a li {
  display: inline-block;
  padding-left: 10px;
  padding-right: 10px;
  background-color: rgba(50, 50, 50, 1.0);
  border-right: 2px solid rgba(100, 100, 100, 1.0);
}
<div class="buttons">
  <ul id="comment-details">
    <a id="reply-button">
      <li> Reply <i class="material-icons" style="font-size: 12pt"> reply </i></li>
    </a>
    <a id="upvote">
      <li> 5 <i class="material-icons" style="font-size: 12pt"> arrow_upward </i></li>
    </a>
    <a id="downvote">
      <li> 1 <i class="material-icons" style="font-size: 12pt"> arrow_downward </i></li>
    </a>
  </ul>
</div>

我希望ul在中间正确并浮动到父div的右侧。

html css html-lists
1个回答
1
投票

CSS可能很棘手,但我认为它导致.button类的填充没有顶部和底部设置所以它的默认值。

此外,ul的顶部和底部的边距也没有设置,因此它可以将其抛弃。

© www.soinside.com 2019 - 2024. All rights reserved.