【问题标题】:Bootstrap tabbed panelBootstrap 选项卡式面板
【发布时间】:2018-07-25 02:24:22
【问题描述】:

我正在尝试弄清楚如何获得“选项卡式面板”。我的面板和选项卡式菜单工作正常,但面板和选项卡式导航之间存在间隙。

我仍在尝试找出这个 Bootstrap 框架,因此非常感谢任何指导。我还附上了一个截图,它看起来像screenshot of tabbed pane。我已经删除了所有 PHP 代码,这样更容易复制。

代码如下:

body {
  padding: 10px;
}

#exTab1 .tab-content {
  color: white;
  background-color: #428bca;
  padding: 5px 5px;
}

#exTab2 h3 {
  color: white;
  background-color: #428bca;
  padding: 5px 5px;
}


/* remove border radius for the tab */

#exTab1 .nav-pills > li > a {
  border-radius: 0;
}


/* change border radius for the tab , apply corners on top*/

#exTab3 .nav-pills > li > a {
  border-radius: 4px 4px 0 0;
}

#exTab3 .tab-content {
  color: white;
  background-color: #428bca;
  padding: 5px 5px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="exTab3" class="container">
  <ul class="nav nav-tabs">
    <li class="active">
      <a href="#overview" data-toggle="tab"><strong>Overview</strong></a>
    </li>
    <li><a href="#assets" data-toggle="tab"><strong>Assets</strong></a>
    </li>
    <li><a href="#services" data-toggle="tab"><strong>Services</strong></a>
    </li>

  </ul>

  <div class="tab-content clearfix">

    <div class="tab-pane active" id="overview">
      <!-- Overview -->
      <!-- Default panel contents -->
      <div class="panel-heading"><i class="fa fa-user" center-block style="font-size:inherit;color:orange;"></i> Overview</div>
      <div class="panel-body">
        <p>Your content here</p>
      </div>
      <!-- /Overview -->
      <div class="col-sm-4">
      </div>
    </div>

    <div class="tab-pane" id="assets">
      <!-- Assets -->
      <div class="panel-heading"><i class="fa fa-bug" center-block style="font-size:inherit;color:orange;"></i> Associated Assets</div>
      <div class="panel-body">
        <p>Your content here</p>
        <!-- Table -->
        <!-- /Assets -->
      </div>
    </div>
    <div class="tab-pane" id="services">
      <!-- Services -->
      <div class="panel-heading"><i class="fa fa-bullhorn" center-block style="font-size:inherit;color:orange;"></i> Associated Services</div>
      <div class="panel-body">
        <p>Your content here</p>
      </div>
    </div>
  </div>

https://jsfiddle.net/richss/mxp8qm2a/20/

更新

将工作代码放到我们的“门户”中,样式等被拉取,截图:

【问题讨论】:

  • 您能否更正您的代码以便我可以帮助您

标签: javascript html css wordpress twitter-bootstrap


【解决方案1】:

您的代码几乎可以运行,您只需要添加jQuery 并关闭资产选项卡&lt;div&gt;,然后再启动服务&lt;div&gt;

在此处查看工作演示 https://jsfiddle.net/dLpm9hgy/2/

或者这里:

body {
  padding: 10px;
}

#exTab1 .tab-content {
  color: white;
  background-color: #428bca;
  padding: 5px 15px;
}

#exTab2 h3 {
  color: white;
  background-color: #428bca;
  padding: 5px 15px;
}


/* remove border radius for the tab */

#exTab1 .nav-pills > li > a {
  border-radius: 0;
}


/* change border radius for the tab , apply corners on top*/

#exTab3 .nav-pills > li > a {
  border-radius: 4px 4px 0 0;
}

#exTab3 .tab-content {
  color: white;
  background-color: #428bca;
  padding: 5px 15px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<div id="exTab3" class="container">
  <ul class="nav nav-tabs">
    <li class="active">
      <a href="#overview" data-toggle="tab"><strong>Overview</strong></a>
    </li>
    <li><a href="#assets" data-toggle="tab"><strong>Assets</strong></a>
    </li>
    <li><a href="#services" data-toggle="tab"><strong>Services</strong></a>
    </li>

  </ul>

  <div class="tab-content clearfix">

    <div class="tab-pane active" id="overview">
      <!-- Overview -->
      <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading"><i class="fa fa-user" center-block style="font-size:inherit;color:orange;"></i> Overview</div>
        <div class="panel-body">
          <p>...</p>
        </div>
      </div>
      <!-- /Overview -->

      <div class="col-sm-4">
      </div>
    </div>
    
    <div class="tab-pane" id="assets">
      <!-- Assets -->
      <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading"><i class="fa fa-bug" center-block style="font-size:inherit;color:orange;"></i> Associated Assets</div>
        <div class="panel-body">

        </div>

        <!-- Table -->

        <!-- /Assets -->
      </div>
    </div>
    <div class="tab-pane" id="services">
      <!-- Services -->
      <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading"><i class="fa fa-bullhorn" center-block style="font-size:inherit;color:orange;"></i> Associated Services</div>
        <div class="panel-body">
          <table class="table">
            <tr>
              <th>Below is a list of associated services for user:</th>

            </tr>


            es -->

        </div>
        <div class="tab-pane" id="4b">

        </div>
      </div>
    </div>

  </div>

【讨论】:

  • 谢谢。这是有道理的.. 几乎在那里但不是 100% 如果您看到面板后面的“蓝色”框。我确定我做错了什么。我希望这一切都排成一行,蓝色有一个边框。这应该会有所帮助:jsfiddle.net/richss/9jomh897
  • 不确定你的意思....你想去掉蓝色吗?检查此jsfiddle.net/dLpm9hgy/7 并告诉我:)
  • 谢谢。我在引导程序相互恐惧方面遇到了一些问题。该代码独立工作。这很简单,但是当我将它添加到我的 wordpress 门户模板中时,它只是剥离了所有内容:示例如下:prnt.sc/ieo35u
  • 哦,wordpress ......哈哈哈......不是专家......我更喜欢从头开始 webdevelop :D....但无论如何......如果你买了一个模板我的建议将联系创作者,他们会告诉您如何将此部分添加到您的网站。否则,如果您使用免费的,您可以在wordpress.stackexchange.com 获得更好的建议
  • 是的,这是一个使用无限主题的非常复杂的门户。非常过分,复杂。这是 bootstrap.css 文件,它剥离了所有内容。
猜你喜欢
  • 2014-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-20
  • 1970-01-01
相关资源
最近更新 更多