On mobile, how do I stack my bootstrap nav tabs vertically? - html

I have five bootstrap nav tabs that are evenly spaced and look great on desktop. On mobile the text of the tabs get squished together. On mobile, how do I have the tabs stack vertically?
It's in the middle of the page so I'd like the five tabs to stack on mobile.
Here's my bootply:
http://www.bootply.com/nM8Q1MftKU
Here's my HTML:
<div class="content-section-c">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Sample Search Results</h2>
</div>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active">ELECTRONIC<br>APPLE TREES</li>
<li>CROSSING GUARD<br>ORANGE TREES</li>
<li>POLICE BODY<br>PEARS TREES</li>
<li>PARKING METERS<br> </li>
<li>TRANSPORTATION<br>GRAPES TREES</li>
</ul>
<div class="tab-content">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane2" class="tab-pane">
<p class="results">75 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/05_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/06_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/07_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/08_card.png"></div>
</div>
<div id="pane3" class="tab-pane">
<p class="results">144 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/09_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/10_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/11_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/12_card.png"></div>
</div>
<div id="pane4" class="tab-pane">
<p class="results">170 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane5" class="tab-pane">
<p class="results">256 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
</div>
<!-- /.tab-content -->
</div>
<!-- /.tabbable -->
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-c -->
Here's my CSS:
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
}
h2 {
font-family: 'Lato', sans-serif;
font-weight: 700;
color: #3C5A78;
line-height: 1;
text-align: center;
padding: 0 0 16px 0;
}
.nav-tabs>li.active>a,
.nav-tabs>li.active>a:focus,
.nav-tabs>li.active>a:hover {
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #e9a39c;
font-weight: bold;
background-color: #d4d4d4 !important;
}
.nav-tabs>li>a:hover {
border: 1px solid transparent;
}
.nav>li>a:focus,
.nav>li>a:hover {
background-color: #d4d4d4;
}
.nav-tabs {
border-bottom: none;
display: inline-block;
/* needed to center the list items */
}
.tabbable {
text-align: center;
}
.results {
font-family: 'Merriweather', serif;
font-weight: 300;
color: #355A78;
font-size: 16px;
margin: 20px 0 5px 0;
text-align: left;
}
.nav-tabs {
width: 100%
}
.nav-tabs > li {
width: 20%;
}

Change the width of the nav-tabs > li in mobile sizes
#media screen and (max-width:767px){
.nav-tabs > li {width:100%;}
}

You could consider a collapsing navbar. See your example on bootply. On small screens there will be the three vertical lines to open the navbar navigation instead of showing all possible links on one vertical line.
Desktop:
Mobile:
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">ELECTRONIC<br>APPLE TREES</li>
<li>CROSSING GUARD<br>ORANGE TREES</li>
<li>POLICE BODY<br>PEARS TREES</li>
<li>PARKING METERS<br> </li>
<li>TRANSPORTATION<br>GRAPES TREES</li>
</ul>
</div>
</div>
</nav>

Related

Bootstrap default padding and margin causing images to stretch outside the container

My images are stretching into the padding/margin that bootstrap uses to divide the columns. I want to keep the columns divided but not have the images stretch. I have been able to shrink the image using padding but then the whitespace between the columns is clickable which is not what I want.
<div id="cont_divider" class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<a href="#" class="image_link_styling">
<div class="col-md-12">
<div id="inner_cont_1">
<div class="row">
<p class="stair_image_font_style">Straight<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/straight.jpg" alt="straight staircase">
</div>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<a href="#" class="image_link_styling">
<div class="col-md-12">
<div id="inner_cont_2">
<div class="row">
<p class="stair_image_font_style">Single Winder<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/single_winder.jpg" alt="straight staircase">
</div>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<a href="#" class="image_link_styling">
<div class="col-md-12">
<div id="inner_cont_3">
<div class="row">
<p class="stair_image_font_style">Double Winder<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/double_winder.jpg" alt="straight staircase">
</div>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<a href="#" class="image_link_styling">
<div class="col-md-12">
<div id="inner_cont_4">
<div class="row">
<p class="stair_image_font_style">Triple Winder<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/triple_winder.jpg" alt="straight staircase">
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
CSS:
#inner_cont_1{
background-color: #336699;
}
#inner_cont_2{
background-color: #cc6633;
}
#inner_cont_3{
background-color: #ff6633;
}
#inner_cont_4{
background-color: #ffcc66;
}
.staircase_imgs{
box-sizing: border-box;
width: 100%;
display: block;
padding: 0 1.238em 0.3em 1.238em;
}
.stair_image_font_style{
font-size: 2em;
color: #ffffff;
line-height: 1em;
padding: 0.8em 0.938em;
margin: 0;
}
.col_divide{
margin-top: 1em;
margin-bottom: 1em;
}
That's because you're using .row without a .col- class. .row has negative left and right margins which will extend the content area out beyond the parent. The padding of a .col- class nullifies this affect. Remove .row.
#import url( 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );
#inner_cont_1 {
background-color: #336699;
}
#inner_cont_2 {
background-color: #cc6633;
}
#inner_cont_3 {
background-color: #ff6633;
}
#inner_cont_4 {
background-color: #ffcc66;
}
.stair_image_font_style {
font-size: 2em;
color: #ffffff;
line-height: 1em;
padding: 0.8em 0.938em;
margin: 0;
}
.col_divide {
margin-top: 1em;
margin-bottom: 1em;
}
<div id="cont_divider" class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<div class="col-md-12">
<a href="#" class="image_link_styling">
<div id="inner_cont_1">
<p class="stair_image_font_style">Straight<br/>Staircase</p>
<img class="img-responsive" src="http://placehold.it/600x400/fc0" alt="straight staircase">
</div>
</a>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<div class="col-md-12">
<a href="#" class="image_link_styling">
<div id="inner_cont_2">
<p class="stair_image_font_style">Single Winder<br/>Staircase</p>
<img class="img-responsive" src="http://placehold.it/600x400/fc0" alt="straight staircase">
</div>
</a>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<div class="col-md-12">
<a href="#" class="image_link_styling">
<div id="inner_cont_3">
<p class="stair_image_font_style">Double Winder<br/>Staircase</p>
<img class="img-responsive" src="http://placehold.it/600x400/fc0" alt="straight staircase">
</div>
</a>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<div class="col-md-12">
<a href="#" class="image_link_styling">
<div id="inner_cont_4">
<p class="stair_image_font_style">Triple Winder<br/>Staircase</p>
<img class="img-responsive" src="http://placehold.it/600x400/fc0" alt="straight staircase">
</div>
</a>
</div>
</div>
</div>
</div>
</div>
P.S. I also removed your .staircase_imgs class as it's not required once you remove the .row elements. I also rearranged some of your markup like a to inside the Bootstrap column element. This way the white space around the column element isn't clickable.
Remove the extra <div class="row"> you have. This creates margin: 0 -15px; for .col to rest in, but you do not have a -col in this .row ... so simply remove it.
Like this:
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<a href="#" class="image_link_styling">
<div class="col-md-12">
<div id="inner_cont_3">
<div class="row"> <!-- REMOVE THIS DIV -->
<p class="stair_image_font_style">Double Winder<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/double_winder.jpg" alt="straight staircase">
</div>
</div>
</div>
</a>
</div>
</div>
First of all, you should place your a tag inside bootstrap column, in order to be inside that padding column. Second, you added unnecessary .row classes.
Your structure should be something like this:
<div class="col-xs-12 col-sm-6 col-md-3 col_divide">
<div class="row text_center">
<div class="col-md-12">
<div id="inner_cont_1">
<a href="#" class="image_link_styling">
<p class="stair_image_font_style">Straight<br/>Staircase</p>
<img class="img-responsive staircase_imgs" src="<?php bloginfo('template_directory'); ?>/images/straight.jpg" alt="straight staircase">
</a>
</div>
</div>
</div>
</div>
I made a fiddle with your code: fiddle
Hope this helps!
your <a> tag starts way outside of the <img> tag. Instead of using the link over the multiple <div>'s try placing the <a> tag just around the <img> See the example below:
<div class="col-md-12">
<a href="..">
<img src="..." class="img-responsive">
</a>
</div>

How do I increase spacing between bootstrap nav tabs?

I'd like my five bootstrap nav tabs to be spread out evenly across the containers. Currently they are in the middle, but there is so much blank space on the left and right sides of the tabs.
Also, for my result text, on mobile is butted up against the left side of the screen with no space. I would like this lined up with the left side of the cards. But it's too far over on the left.
Here's my bootply:
http://www.bootply.com/EJO7TvV3B3
Here's my HTML:
<div class="content-section-c">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Sample Search Results</h2>
</div>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#pane1" data-toggle="tab">APPLE<br>
TREES
</a></li>
<li>ORANGE<br>TREES</li>
<li>PEARS <br> TREES</li>
<li>BANANAS<br> </li>
<li>GRAPE<br> TREES</li>
</ul>
<div class="tab-content">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane2" class="tab-pane">
<p class="results">75 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/05_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/06_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/07_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/08_card.png"></div>
</div>
<div id="pane3" class="tab-pane">
<p class="results">144 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/09_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/10_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/11_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/12_card.png"></div>
</div>
<div id="pane4" class="tab-pane">
<p class="results">170 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane5" class="tab-pane">
<p class="results">256 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.tabbable -->
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-c -->
Here's my css:
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
}
h2 {
font-family: 'Lato', sans-serif;
font-weight: 700;
color: #3C5A78;
line-height: 1;
text-align:center;
padding: 0 0 16px 0;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #e9a39c;
font-weight: bold;
background-color: #d4d4d4 !important;
}
.nav-tabs>li>a:hover{
border: 1px solid transparent;
}
.nav>li>a:focus, .nav>li>a:hover{
background-color: #d4d4d4;
}
.nav-tabs{
border-bottom: none;
display: inline-block; /* needed to center the list items */
}
.tabbable{
text-align: center;
}
.results {
font-family: 'Merriweather', serif;
font-weight: 300;
color: #355A78;
font-size: 16px;
margin: 20px 0 5px 0;
text-align: left;
}
Ok, this will not be a small answer but it could help you on your way understanding where you're problems are.
First of all i see some misuse of the Bootstrap code and wrappers:
You have one container <div class="container"> on the second line that wraps all of you're code. That works but it's not really the purpose of a container to wrap all of you're code. You allready have a wrapper <div class="content-section-c"> so why use a second one, or in you're example even a third one <div class="tabbable">?
When you use <div class="container"> you will be limited to the width of a container and that is maximum 1170px. So that is why you're having that much margin left and right of the navigation. Bootstrap have a class container-fluid <div class="container-fluid"> that takes the full width of the screen. So in you're example i would use that class for your navigation section
Fixing you're code with my comments above you could change the navigation to this:
<div class="content-section-c">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2>Sample Search Results</h2>
<ul class="nav nav-tabs">
<li class="active">
APPLE<br>TREES
</li>
<li>
ORANGE<br>TREES
</li>
<li>
PEARS <br> TREES
</li>
<li>
BANANAS<br>
</li>
<li>
GRAPE<br> TREES
</li>
</ul>
</div>
</div>
</div>
Now the navigation bar is pulled to the left side, that is normal behaviour because you did not set any with to the ul and li so changing the css a bid will fix that to
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
text-align: center;
}
.content-section-c ul {
width: 100%
}
.content-section-c ul li {
margin: 3%;
width: 14%;
}
To explain above css in detail, first of all you had a class .tabbable {text-align: center;} but we removed that wrapper (because you allready had one) Now you have to add that style text-align:center to the wrapper we kept content-section-c.
Give the ul a width of 100% so it takes all of the width.
You could give the li a width of 20%, because you use underlining of active list items the line underneath would actually take 20% and that's not really nice. So i did some css trick and added some margin on the list items.
Attention you will need to use some #media queries to drop that margin on smaller screens
That was actually the question you had isn't it? Still to give you some extra tips and information i can tell you this:
A bootstrap container is actually a container of row elements
and a bootstrap row is actually a container of columns col-*-*
Source: when-should-i-use-class-container-and-row
So if you look at the rest of you're code you could do something like this. Put every (column) group inside of a row.
<div class="tab-content">
<div class="container">
<div class="row">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png">
</div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png">
</div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png">
</div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png">
</div>
</div>
</div>
And here you have a bootply with you're previous code cleaned up, good luck!
Bootply
I correct it. Hope you want like this.
/* CSS used here will be applied after bootstrap.css */
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
}
h2 {
font-family: 'Lato', sans-serif;
font-weight: 700;
color: #3C5A78;
line-height: 1;
text-align:center;
padding: 0 0 16px 0;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #e9a39c;
font-weight: bold;
background-color: #d4d4d4 !important;
}
.nav-tabs>li>a:hover{
border: 1px solid transparent;
}
.nav>li>a:focus, .nav>li>a:hover{
background-color: #d4d4d4;
}
.nav-tabs{
border-bottom: none;
display: inline-block; /* needed to center the list items */
}
.tabbable{
text-align: center;
}
.results {
font-family: 'Merriweather', serif;
font-weight: 300;
color: #355A78;
font-size: 16px;
margin: 20px 0 5px 0;
text-align: left;
}
ul.nav{
width:100%;
}
.nav-tabs>li {
width: 20%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="content-section-c">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Sample Search Results</h2>
</div>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#pane1" data-toggle="tab">APPLE<br>
TREES
</a></li>
<li>ORANGE<br>TREES</li>
<li>PEARS <br> TREES</li>
<li>BANANAS<br> </li>
<li>GRAPE<br> TREES</li>
</ul>
<div class="tab-content">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane2" class="tab-pane">
<p class="results">75 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/05_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/06_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/07_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/08_card.png"></div>
</div>
<div id="pane3" class="tab-pane">
<p class="results">144 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/09_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/10_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/11_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/12_card.png"></div>
</div>
<div id="pane4" class="tab-pane">
<p class="results">170 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane5" class="tab-pane">
<p class="results">256 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.tabbable -->
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-c -->

Bootstrap navs problems (jumps up on click, mobile not rendering correctly

I'm having the following bootstrap nav problems:
1) On desktop, when you click on each tab, it jumps up 1 pixel.
2) On mobile, the labels are all squished together (see attached photo)
3) Also on mobile, there is no space between each card when stacked
4) On desktop and mobile, the cards don't line up all the way to the left edge. You can see the "75 Results Found" text is where it should line up.
5) How do I text align the tab labels to the left (currently they are rendering in the center)
Here's my bootply:
http://www.bootply.com/nM8Q1MftKU
Here's my HTML:
<div class="content-section-c">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Sample Search Results</h2>
</div>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active">ELECTRONIC<br>APPLE TREES</li>
<li>CROSSING GUARD<br>ORANGE TREES</li>
<li>POLICE BODY<br>PEARS TREES</li>
<li>PARKING METERS<br> </li>
<li>TRANSPORTATION<br>GRAPES TREES</li>
</ul>
<div class="tab-content">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane2" class="tab-pane">
<p class="results">75 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/05_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/06_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/07_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/08_card.png"></div>
</div>
<div id="pane3" class="tab-pane">
<p class="results">144 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/09_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/10_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/11_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/12_card.png"></div>
</div>
<div id="pane4" class="tab-pane">
<p class="results">170 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane5" class="tab-pane">
<p class="results">256 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.tabbable -->
</div>
</div>
<!-- /.container -->
Here's my css:
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
}
h2 {
font-family: 'Lato', sans-serif;
font-weight: 700;
color: #3C5A78;
line-height: 1;
text-align:center;
padding: 0 0 16px 0;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #e9a39c;
font-weight: bold;
background-color: #d4d4d4 !important;
}
.nav-tabs>li>a:hover{
border: 1px solid transparent;
}
.nav>li>a:focus, .nav>li>a:hover{
background-color: #d4d4d4;
}
.nav-tabs{
border-bottom: none;
display: inline-block; /* needed to center the list items */
}
.tabbable{
text-align: center;
}
.results {
font-family: 'Merriweather', serif;
font-weight: 300;
color: #355A78;
font-size: 16px;
margin: 20px 0 5px 0;
text-align: left;
}
.nav-tabs {
width: 100%
}
.nav-tabs > li {
width: 20%;
}
1) In your css-code this line makes it jump up:
.nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover {
border-bottom: 3px solid #e9a39c;
}
2) The labels take 20% of the screen in your css-code:
.nav-tabs > li {
width: 20%;
}
3) You have to overwrite the bootstrap.css code and you have to use media queries in your css-code.
Explanation of media queries:http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
Add this to your css-code at the end of it, change max-width to what you want:
#media screen and (max-width : 640px){
img.img-responsive {
margin-top: 20px !important;
}
}
4) You have to overwrite the bootstrap.css code
Add this to your css-code:
.col-md-6 {
padding: 0 !important;
margin: 0 !important;
}
5) Add a line to your css-code:
.nav-tabs {
text-align:left;
width: 100%
}

Bootstrap nav tabs...where to put 100% on ul and 20% to each tab to fill the entire space?

Bootstrap nav tabs...where to put 100% on ul and 20% to each tab to fill the entire space?
I'd like my five bootstrap nav tabs to be spread out evenly across the containers. Currently they are in the middle, but there is so much blank space on the left and right sides of the tabs.
I think if I put my UL to be 100% and have each tab at 20% it may work. But where do I put those values?
Also, when I click "Grape Trees", it just shows the same information as "Bananas". Why won't it change?
here's my bootply:
http://www.bootply.com/GB3f0moehB
Here's my HTML:
<div class="content-section-c">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Sample Search Results</h2>
</div>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#pane1" data-toggle="tab">APPLE<br>
TREES
</a></li>
<li>ORANGE<br>TREES</li>
<li>PEARS <br> TREES</li>
<li>BANANAS<br> </li>
<li>GRAPE<br> TREES</li>
</ul>
<div class="tab-content">
<div id="pane1" class="tab-pane active">
<p class="results">126 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane2" class="tab-pane">
<p class="results">75 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/05_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/06_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/07_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/08_card.png"></div>
</div>
<div id="pane3" class="tab-pane">
<p class="results">144 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/09_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/10_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/11_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/12_card.png"></div>
</div>
<div id="pane4" class="tab-pane">
<p class="results">170 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
<div id="pane5" class="tab-pane">
<p class="results">256 Results Founds</p>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/01_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/02_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/03_card.png"></div>
<div class="col-md-6 col-xs-12">
<img class="img-responsive" src="http://www.onvia.com/responsive/04_card.png"></div>
</div>
</div><!-- /.tab-content -->
</div><!-- /.tabbable -->
</div>
</div>
<!-- /.container -->
</div>
<!-- /.content-section-c -->
Here's my CSS:
.content-section-c {
padding: 50px 0;
background-color: #d4d4d4;
}
h2 {
font-family: 'Lato', sans-serif;
font-weight: 700;
color: #3C5A78;
line-height: 1;
text-align:center;
padding: 0 0 16px 0;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid #e9a39c;
font-weight: bold;
background-color: #d4d4d4 !important;
}
.nav-tabs>li>a:hover{
border: 1px solid transparent;
}
.nav>li>a:focus, .nav>li>a:hover{
background-color: #d4d4d4;
}
.nav-tabs{
border-bottom: none;
display: inline-block; /* needed to center the list items */
}
.tabbable{
text-align: center;
}
.results {
font-family: 'Merriweather', serif;
font-weight: 300;
color: #355A78;
font-size: 16px;
margin: 20px 0 5px 0;
text-align: left;
}
Add width: 100% to .nav-tabs and create a new style for li as below
.nav-tabs li {
width: 20%;
}
http://www.bootply.com/93t8KTXgnA
.nav-tabs {width: 100%} .nav-tabs > li {width: 20%;}
+
You should change attr href of Grapes
`<li>GRAPE<br> TREES</li> `
Make the parent ul ".nav-tabs" 100% so it should fill the width of the container. Then make each li element under the ".nav-tabs" 20%:
.nav-tabs{
border-bottom: none;
display: inline-block; /* needed to center the list items */
width: 100%;
}
.nav-tabs>li {
width: 20%;
}

How can i make this grid layout always stay the same size bootstrap 3?

I'm trying to make a grid layout with images inside, The images aren't always the same size, Some of them seem to make the layout of the grid slightly smaller and i can't figure out a way to get them all the same size.
Here's the HTML.
<div class="col-xs-12">
<div class="row">
<h2>Handheld Consoles</h2>
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-4">
<a href="#">
<div class="tile purple text-center">
<h3 class="title">Nintendo 3DS</h3>
<div class="col-xs-12"><img class="img-responsive" style="max-height:128px; max-width:128px" src="../images/3ds.png" /></div>
</div>
</a>
</div>
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-4">
<a href="#">
<div class="tile red text-center">
<h3 class="title">Nintendo GBA</h3>
<div class="col-xs-12"><img class="img-responsive" style="max-height:128px; max-width:128px" src="../images/gba.png" /></div>
</div>
</a>
</div>
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-4">
<a href="#">
<div class="tile orange text-center">
<h3 class="title">Nintendo 64</h3>
<div class="col-xs-12"><img class="img-responsive" style="max-height:128px; max-width:128px" src="../images/n64.png" /></div>
</div>
</a>
</div>
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-4">
<a href="#">
<div class="tile green text-center">
<h3 class="title">Sony PSP</h3>
<div class="col-xs-12"><img class="img-responsive" style="max-height:128px; max-width:128px" src="../images/psp.png" /></div>
</div>
</a>
</div>
</div>
</div>
And the CSS.
.tile {
width:100%;
display: inline-block;
box-sizing: border-box;
background: #fff;
padding: 15px;
margin-bottom: 20px;
color:#fff;
}
.title {
margin-top: 0px;
text-align:center;
}
.purple {
background: #5133AB;
}
.purple:hover {
background: #3e2784;
}
i believe if you just set the height of class .tile, it should work
.tile {
width:100%;
display: inline-block;
box-sizing: border-box;
background: #fff;
padding: 15px;
margin-bottom: 20px;
color:#fff;
height: 200px; // or whatever height you want all the tiles to be
}