我在引导程序中使用了一些自定义垂直标签的代码,我尝试将它们设置为水平,并在每个标签下方显示文字,但我无法理解具体方法。
<section id="about">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="feature_header text-center">
<h3 class="feature_title"><b>Tabs</b></h3>
</div>
</div>
</div>
<div class="row">
<div class="feature-tab">
<div class="col-md-2 col-sm-3 col-xs-12">
<ul class="nav nav-tabs main-tab-list text-center" role="tablist">
<li role="presentation" class="active">
<a href="#home" role="tab" data-toggle="tab" >
<div class="single-tab">
<div class="f-icon">
<i class="fa fa-laptop"></i>
</div>
</div>
<h4>Tab 1</h4>
</a>
</li>
<li role="presentation" >
<a href="#profile" role="tab" data-toggle="tab">
<div class="single-tab">
<div class="f-icon">
<i class="fa fa-send"></i>
</div>
</div>
<h4>Tab 2</h4>
</a>
</li>
<li role="presentation" >
<a href="#messages" role="tab" data-toggle="tab">
<div class="single-tab">
<div class="f-icon">
<i class="fa fa-heart"></i>
</div>
</div>
<h4>Tab 3</h4>
</a>
</li>
</ul>
</div> <!-- col-md-12 end -->
<div class="col-md-10 col-sm-9 col-xs-12">
<div class="tab-content main-tab-content">
<div role="tabpanel" class="tab-pane active " id="home">
<div class="col-md-12 col-sm-9">
<div class="c-tab">
<h4>Tab 1</h4>
<p>Lorem ipsum.... </p>
<a href="#"> More</a>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane active " id="home">
<div class="col-md-12 col-sm-9">
<div class="c-tab">
<h4>Tab 2</h4>
<p>Lorem ipsum.... </p>
<a href="#"> More</a>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane active " id="home">
<div class="col-md-12 col-sm-9">
<div class="c-tab">
<h4>Tab 3</h4>
<p>Lorem ipsum.... </p>
<a href="#"> More</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
我不会发布CSS因为会很长而不会发布JsFiddle。
为了更清楚,我已经做了Jsfiddle。有人能告诉我这将如何横向发展。我的意思是Tab 1
,Tab 2
和Tab 3
..
答案 0 :(得分:3)
你可以尝试如下,我只是编辑你的下面的课程,它的工作原理!
你应该总是把风格float: left;
和display: inherit;
放在一起来做魔术:)
.main-tab-list li{
padding: 10px 0px 10px;
border: 1px solid#eee;
width: 150px;
/* background: #FBFBFB; */
float: left;
margin-bottom: 5px;
border-radius: 5px;
display: inherit;
margin-right: 5px;
}
答案 1 :(得分:1)
从.col-md
父级删除.nav-tabs
类,并将其替换为.row
类,并且``应该是:
.main-tab-list li{
position: relative;
display: inline-block;
float: left; /* or none */
padding: 10px 0px 10px;
border: 1px solid#eee;
width: 150px;
/*background: #FBFBFB;*/
margin-bottom: 5px;
border-radius: 5px;
}