将右对齐的导航标签与标题元素对齐

时间:2018-07-19 16:18:00

标签: css twitter-bootstrap-3

我正在尝试使用bootstrap 3制作一个右对齐的nav-tab

<div class="col-md-12 comments-header">
    <h3 pull-left style="display: inline">1 Comment</h3>
    <ul class="nav nav-tabs"
        <li role="presentation" class="active pull-right">
            <a href="#">Home</a>
        </li>
        <li role="presentation" class="pull-right">
            <a href="#">Profile</a>
        </li>
        <li role="presentation" class="pull-right">
            <a href="#">Messages</a>
        </li>
    </ul>
</div><!-- comments-header -->

How to align tabs to top/right in bootstrap 3?提供的解决方案部分起作用,除了无法将标题注释与标签对齐之外

enter image description here

我尝试了将<h3>集成到标签行中的方法,但是标签实际上占据了整个

1 个答案:

答案 0 :(得分:0)

我稍微整理了一下代码:

<div class="col-md-12 comments-header">
  <h3 class="pull-left" style="display: inline;">1 Comment</h3>
  <ul class="nav nav-tabs">
    <li role="presentation" class="active pull-right">
      <a href="#">Home</a>
    </li>
    <li role="presentation" class="pull-right">
      <a href="#">Profile</a>
    </li>
    <li role="presentation" class="pull-right">
      <a href="#">Messages</a>
    </li>
  </ul>
</div>

<h3>标记未将“ pull-left”指定为类,并且<ul>的起始标记未包含右括号。上面的修订版应将“ 1条评论”浮动到左侧,然后将选项卡移到右侧。