I have seen this post, but being a new user I can't comment to ask for clarification.
I'm using the justified nav tabs in Bootstrap and don't want them to stack on small screens, since I only have 2 tabs. I would like them to remain side by side, just shrink down to fit the screen. This is what I have:
<!-- Nav tabs --> <ul class="nav nav-tabs nav-justified" id="myTab"> <li class="active"><a href="#ratings" data-toggle="tab">Ratings</a></li> <li><a href="#reviews" data-toggle="tab">Reviews</a></li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="ratings">This is a rating section</div> <div class="tab-pane" id="reviews">This is for reviews. There should be some styling here.</div> </div>
As the related post suggests using media queries, I cannot seem to make that work. I had tried setting the following to target just small screens:
@media (max-width: 768px) { .nav-justified > li {display: table-cell;} }
I'm not sure what I'm doing wrong so any help is greatly appreciated.
If you click on any tab, including the currently active one, the visual cue shows up highlighting the tab.
To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a . tab-pane class with a unique ID for every tab and wrap them inside a <div> element with class . tab-content .
Q14 - Which of the following bootstrap styles are used to create a disabled tab in tabs navigation? For each of the . nav classes, if you add the . disabled class, it will create a gray link that also disables the: hover state.
nav class. Bootstrap tabs separate data in the same wrappers but different panes. Pills are components placed in pages to speed up browsing. Also, the first step of adding links inside navbar is to apply <ul> element together with class="navbar-nav".
The problem with some of the other solutions is that the tabs will lose their borders and other design elements. The following media queries more fully ensure the tabs match in both condensed and wider displays:
@media (max-width: 768px) { .nav-justified > li { display: table-cell; width: 1%; } .nav-justified > li > a { border-bottom: 1px solid #ddd !important; border-radius: 4px 4px 0 0 !important; margin-bottom: 0 !important; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With