gpt4 book ai didi

css - Bootstrap 2 列选项卡

转载 作者:行者123 更新时间:2023-11-28 03:22:34 26 4
gpt4 key购买 nike

我想制作一个 nav-tabs ul 以 2 列而不是水平方式呈现其内容(这是 bootstrap nav-tabs 的默认样式)。

我尝试了 css 属性 column-count: 2 但它不起作用

下面是我的代码

<ul class="nav nav-tabs ml-0 mr-0 bg-primary two-columns" role="tablist" style="column-count: 2;">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#cont1" role="tab">Title 1</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont2" role="tab">Title 2</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont3" role="tab">Title 3</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont4" role="tab">Title 4</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont5" role="tab">Title 5</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont6" role="tab">Title 6</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont7" role="tab">Title 7</a></li>
<li class="nav-item"><a class="nav-link " data-toggle="tab" href="#cont8" role="tab">Title 8</a></li>
</ul>


<!-- Tab panes -->
<div class="tab-content ml-2 mr-2">
<div class="tab-pane jumbotron active" id="cont1" role="tabpanel">Conctent 1</div>
<div class="tab-pane jumbotron active" id="cont2" role="tabpanel">Conctent 2</div>
<div class="tab-pane jumbotron active" id="cont3" role="tabpanel">Conctent 3</div>
<div class="tab-pane jumbotron active" id="cont4" role="tabpanel">Conctent 4</div>
<div class="tab-pane jumbotron active" id="cont5" role="tabpanel">Conctent 5</div>
<div class="tab-pane jumbotron active" id="cont6" role="tabpanel">Conctent 6</div>
<div class="tab-pane jumbotron active" id="cont7" role="tabpanel">Conctent 7</div>
<div class="tab-pane jumbotron active" id="cont8" role="tabpanel">Conctent 8</div>
</div>

和我的自定义 css 类 双列

ul.two-columns {
-moz-column-count: 2 !important;
-moz-column-gap: 2.5em !important;
-webkit-column-count: 2 !important;
-webkit-column-gap: 2.5em !important;
column-count: 2 !important;
column-gap: 2.5em !important;
}

我想 Bootstrap 中包含的 JavaScript 会阻止我的自定义样式。下面是我的代码

有没有人知道如何实现这一点?

最佳答案

试试这个答案

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<style>
.tabs-left{
border-bottom: none;
padding-top: 2px;
}
.tabs-left {
border-right: 1px solid #ddd;
}
.tabs-left>li {
float: none;
margin-bottom: 2px;
}
.tabs-left>li {
margin-right: -1px;
}
.tabs-left>li.active>a,
.tabs-left>li.active>a:hover,
.tabs-left>li.active>a:focus {
border-bottom-color: #ddd;
border-right-color: transparent;
}

.tabs-left>li>a {
border-radius: 4px 0 0 4px;
margin-right: 0;
display:block;
}
</style>

<div class="row" style="min-height:300px;">
<div class="col-sm-6">
<div class="col-xs-3">
<!-- required for floating -->
<!-- Nav tabs -->
<ul class="nav nav-tabs tabs-left">
<li class="nav-item active"><a class="nav-link" data-toggle="tab" href="#cont1" role="tab">Title 1</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont2" role="tab">Title 2</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont3" role="tab">Title 3</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont4" role="tab">Title 4</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont5" role="tab">Title 5</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont6" role="tab">Title 6</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont7" role="tab">Title 7</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#cont8" role="tab">Title 8</a></li>
</ul>
</div>
<div class="col-xs-9">
<!-- Tab panes -->
<div class="tab-content ml-2 mr-2">
<div class="tab-pane jumbotron active" id="cont1" role="tabpanel">Conctent 1</div>
<div class="tab-pane jumbotron" id="cont2" role="tabpanel">Conctent 2</div>
<div class="tab-pane jumbotron" id="cont3" role="tabpanel">Conctent 3</div>
<div class="tab-pane jumbotron" id="cont4" role="tabpanel">Conctent 4</div>
<div class="tab-pane jumbotron" id="cont5" role="tabpanel">Conctent 5</div>
<div class="tab-pane jumbotron" id="cont6" role="tabpanel">Conctent 6</div>
<div class="tab-pane jumbotron" id="cont7" role="tabpanel">Conctent 7</div>
<div class="tab-pane jumbotron" id="cont8" role="tabpanel">Conctent 8</div>
</div>
</div>
<div class="clearfix"></div>
</div>

关于css - Bootstrap 2 列选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45140364/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com