【问题标题】:How to dynamically adjust width of nav-tabs so it fills up the screen如何动态调整导航选项卡的宽度以填满屏幕
【发布时间】:2019-08-28 20:25:55
【问题描述】:

我有一个如下所示的导航标签:

我使用的是省略号,但我不喜欢我的导航分散在第二行。我不想使用 nav-justfied 而是能够挤压我的

  • 所以它适合屏幕并且用户不必水平滚动。

    如下图

    到目前为止我的代码

    .nav-tabs>li:not(.active)>a {
      background-color: white;
      border: 1px solid #ddd;
      border-bottom: none;
      border-top: 3px solid #9d9d9d;
      text-overflow: ellipsis;
      max-width: 10em;
      overflow: hidden;
      display: block;
    }
    
    .nav-tabs {
      padding-left: 15px;
      padding-right: 15px;
      padding-top: 15px;
      white-space: nowrap;
    }
    
    <ul class="nav nav-tabs">
    
      <div class="btn-toolbar pull-right">
        {% block tab_buttons %}
        {% endblock %}
      </div>
    
      <li role="presentation" class="{% if '/hosts' in request.path %}active {% endif %}inverse"><a href="{% url 'sc:events:hosts-list' event.id %}" role="tab">Hosts</a></li>
      {% for tab in event.benchmarks.all %}
      <li role="presentation" class="{% if 'summary' in request.path and tab == benchmark %}active {% endif %}inverse"><a href="{% url 'sc:events:benchmarks-summary' event.id tab.id %}" role="tab">{{ tab.name }}</a></li>
      {% endfor %}
    </ul>
    
  • 【问题讨论】:

      标签: html css twitter-bootstrap twitter-bootstrap-3 tabs


      【解决方案1】:

      我不是 100% 确定你在问什么,但听起来你可以从使用中受益:

      display flex 在您的导航栏上。

      如果您在同一页面上加载内容(例如管理面板),我强烈推荐Jquery Tabs。

      【讨论】:

        【解决方案2】:

        在标签上使用Display:inline-flex; css 属性。

        【讨论】:

          猜你喜欢
          • 2013-05-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-03-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多