Im want to arrange all the nav tabs in a single row (in line with hr element).
I dont want any space between hr element and tabs.
After updating margin-top, for Technical Documentation tab, it seems fine, but for 1st tab , Products tab, still gap seems to be there between the hr.
Gap in the 1st tab
I have the below code like:
UPDATED:
<div class="container">
<ul class="nav nav-tabs search-results-navtab">
<li class="active search-list-class">
<a data-toggle="tab" href="#products">Products <br/></a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#multilayer_inductors_series"> Technical
<br/>Documentation</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#smdpower_inductors_series">Support</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#molding_inductors_series">Component
<br/> Selector</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#shieldedsmdpower_inductors_series">Quality</a>
</li>
</ul>
<hr class="search-hr">
</div>
The Css is as:
.search-hr {
margin-top: 0px;
}
.search-results-navtab {
padding-left: 0px;
margin-left: 32px;
margin-right: 70px;
margin-bottom: 1px;
list-style: none;
border: 0px !important;
background-color: white;
}
.search-list-class {
padding-right: 100px;
}
Solution #1
Remove the margin-top value from the hr element.
hr {
margin-top: 0px;
}
This will retain the margin-bottom value which you may need for spacing.
Solution #2
Alternatively, and I would recommend this, remove the hr element and declare border-bottom on a containing parent element of your list items (li), like .nav, then declare a margin-bottom property if you need bottom spacing.
<div class="container">
<ul class="nav nav-tabs search-results-navtab">
<li class="active search-list-class">
<a data-toggle="tab" href="#products">Products <br/></a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#multilayer_inductors_series"> Technical
<br/>Documentation</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#smdpower_inductors_series">Support</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#molding_inductors_series">Component
<br/> Selector</a>
</li>
<li class="search-list-class">
<a data-toggle="tab" href="#shieldedsmdpower_inductors_series">Quality</a>
</li>
</ul>
</div>
Additional Styles Declared:
.nav {
border-bottom: 1px solid #ccc;
margin-bottom: 10px; /* adjust as per requirement */
}
Related
I have this list:
<div class="col-lg-3 col-md-6">
<ul class="nav nav-pills nav-pills-primary nav-pills-icons flex-column">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#link10">
<i class="tim-icons icon-istanbul"></i> Home
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#link11">
<i class="tim-icons icon-settings"></i> Settings
</a>
</li>
</ul>
</div>
I would like to show a scrollbar when the list reach a specific number of items eg: 3, how can I do this?
You can check the list above working in Vertical Tabs With Icons example here.
Something like this
.nav {
display: block;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 0;
list-style: none;
height: 360px;
width: 150px;
overflow-y: auto;
}
ol li, ul li {
color: #fff;
height: 118px;
}
li.nav-item { display: block; width: 100%; position: relative; display: lock; min-height: 40px; line-height: 2.4; padding: 0; color: #f0f0f0; font-weight: 600; font-size: 16px; border-bottom: 1px solid #092a3b; background: #233d4a; margin: 0;
}
a {
display:block;
}
a.active {
background-color:red;
}
<ul>
<li class="nav-item">
<a class="" data-toggle="collapse" href="#" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">1</a>
<div id="collapseOne" class="collapse" data-parent="#Menu">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" data-parent="#collapseOne">
<a class="" data-toggle="tab" href="#One1">1.1</a>
</li>
<li class="nav-item" data-parent="#collapseOne">
<a class="" data-toggle="tab" href="#One2">1.2</a>
</li>
<li class="nav-item" data-parent="#collapseOne">
<a class="" data-toggle="tab" href="#One3">1.3</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="" data-toggle="collapse" href="#" data-target="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">2</a>
<div id="collapseTwo" class="collapse" data-parent="#Menu">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="" data-toggle="tab" href="#Two1">2.1</a>
</li>
<li class="nav-item">
<a class="" data-toggle="tab" href="#Two2">2.2</a>
</li>
<li class="nav-item">
<a class="" data-toggle="tab" href="#Two3">2.3</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="" data-toggle="tab" href="#Three">3</a>
</li>
<li class="nav-item">
<a class="" data-toggle="tab" href="#Four">4</a>
</li>
</ul>
I am struggling to achieve a multi level tablist menu with collapsible sub menus with Bootstrap 4. I need to use tabs and collapse at the same time. I have achieved to make the functionality (the right panes appearing and disappearing clicking the right links) work properly but there are more than one tab with the active class at the same time. I would like to know if there´s a way to make it work properly just with bootstrap 4 classes not adding more js/jquery code.
Here´s my codepen:
https://codepen.io/AlbertoAguado/pen/XqdmbK
The problem is combining tabs and collapse on the same parent level. Currently, 1&2 toggle tabs, and 3&4 toggle collapse. You need to make them all collapse with tabs inside (exactly like collapse 1&2), or make them all collapse items inside the #Menu.
Additionally, you need to hide any shown tabs when one of the collapse elements is hidden..
$('.collapse').on('hide.bs.collapse', function () {
$('.tab-content .show').removeClass('show');
})
https://codeply.com/go/Aq4zWAcUkX
I would like to reproduce navigation control with tabs like this:
with bootstrap and with (https://fezvrasta.github.io/bootstrap-material-design/docs/4.0/material-design/navs/) - material design bootstrap...
Is there a way to put tab bars below the navbar-brand items?
I found the solution: I inspect the CSS of the library that has this and try to mimic it.
The end solution:
CSS
.my_nav {
height: auto;
display: flex;
flex-wrap: wrap;
}
.my_div {
min-height: 56px;
height: auto;
display: flex;
flex: 1;
}
.my_content {
margin: 0;
flex: 0 0 100%;
}
.nav-tabs .nav-link {
padding: 0.55em 1.15em;
}
html
<nav class="navbar navbar-expand my_nav ">
<div class="my_div">
Home
<ul id="nav-mobile" class="navbar-nav ml-auto right">
<li class="nav-item"><a class="nav-link ">Wellcome {{ user.username }}</a></li>
<li class="nav-item"><a class="nav-link ">Log Out</a></li>
</ul>
</div>
<div class="my_content">
<ul class="nav nav-tabs ">
<li class="nav-item"><a class="nav-link" >Test 1</a></li>
<li class="nav-item"><a class="nav-link" >Test 2</a></li>
<li class="nav-item"><a class="nav-link active" >Test 3</a></li>
</ul>
</div>
</nav>
I am trying to create a responsive navbar for mobile, but I am having trouble getting the link containers to resize properly. I also cannot seem to get the text to center itself vertically. I have tried using auto padding and margins in both cases, but they don't seem to be doing anything. I am using Bootstrap.
My questions are:
How do I center the text vertically within its container?
How do I get the width of each link's container to be the width of the text
How do I then get the spacing between each container to be the same, so that all together they fill the width of the screen?
HTML
<div class="container" id="nav-container-mobile">
<ul class="list-unstyled list-inline text-center d-flex" id="nav-list-mobile">
<li class="list-inline-item text-center nav-link-horizontal" id="nav-profile-link-mobile">
<a class="nav-link" href="#Profile">
<div class="nav-link-container-mobile">Profile</div>
</a>
</li>
<li class="list-inline-item text-center nav-link-horizontal" id="nav-experience-link-mobile">
<a class="nav-link" href="#Experience">
<div class="nav-link-container-mobile">Experience</div>
</a>
</li>
<li class="list-inline-item text-center nav-link-horizontal" id="nav-skills-link-mobile">
<a class="nav-link" href="#Skills">
<div class="nav-link-container-mobile">Skills</div>
</a>
</li>
<li class="list-inline-item text-center nav-link-horizontal" id="nav-project-link-mobile">
<a class="nav-link" href="#project">
<div class="nav-link-container-mobile">Projects</div>
</a>
</li>
<li class="list-inline-item text-center nav-link-horizontal" id="nav-contact-link-mobile">
<a class="nav-link" href="#Contact">
<div class="nav-link-container-mobile">Contact</div>
</a>
</li>
</ul>
</div>
CSS
#nav-container-mobile {
position: absolute;
width: 100%;
height: 70px;
padding: 0;
background: #292929;
z-index: 5;
}
#nav-list-mobile {
width: 100%;
height: 100%;
margin: 0;
vertical-align: middle;
}
.nav-link-horizontal {
height: 100%;
width: 15vw;
min-width: 50px;
}
.nav-link-container-mobile {
padding: auto;
height: 100%;
overflow-wrap: break-word;
}
.nav-link {
color: #aeaeae;
}
Any help or advice is appreciated.
JSFiddle
It would be simpler to use the Bootstrap 4 Nav Fill or Justify, and then just change the background color and other styles as needed.
https://www.codeply.com/go/WsWHHIfRlh
<div class="navbar navbar-expand navbar-dark" id="nav-container-mobile">
<div class="container-fluid">
<ul class="navbar-nav nav-fill w-100">
<li class="nav-item">
<a class="nav-link" href="#">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">Experience</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Skills</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</div>
#nav-container-mobile {
width: 100%;
height: 70px;
padding: 0;
background: #292929;
z-index: 5;
}
.nav-link {
color: #aeaeae;
}
I'm using Bootstrap to develop a menu for a client, but for some reason when I click certain tabs in mobile or tablet mode, the tabs "jump" to another location on the list and leaves an ugly space in between tabs. I made a .gif to show what I'm talking about.
Any ideas why this is happening? I included my own HTML and CSS below. Keep in mind I'm using Bootstrap CSS and JS as well.
EDIT: I think it may have to do something with floats.
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#waxing" role="tab"> WAXING </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#nail-art" role="tab"> NAIL ART </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#nail-enchancements" role="tab">
<div class="hidden-xs"> NAIL ENCHANCEMENTS </div>
<div class="hidden-sm hidden-md hidden-lg hidden-xl"> NAIL ENH </div>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#children" role="tab"> FOR CHILDREN </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#vitamin-dip" role="tab"> VITAMIN DIPS </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#gel-services" role="tab"> GEL SERVICES </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#combo-services" role="tab"> COMBINATIONS </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#pedicure" role="tab"> PEDICURES </a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#manicure" role="tab"> MANICURES </a>
</ul>
CSS
.nav-tabs{
background-color:#fff;
border-radius: 3px 6px 0px 0px;
}
.nav-tabs > li {
float: right;
margin-bottom: -1px;
background-color: #fff;
margin:auto;
}
#media(max-width:992px){
.nav-tabs > li {
width:50%;
}
}
.nav-tabs > li.active > a:focus, .nav-tabs > li.active {
border-bottom-style:none;
border-bottom-width: 0px;
background-color: #d3d3d3;
margin-bottom: -1px;
}
#menu-tabs .nav-link{
font-weight: bold;
color: #000;
font-size: 0.8em;
}
#waxing li, #other li {
line-height: 23px;
}
I solved my problem. I did it by explicitly setting the height of each li.
#media(max-width:992px){
.nav-tabs > li {
height: 37px;
width:50%;
text-align:center;
}
}
I think my problem was that I assumed all the li will keep the same height when I click on the link (focus on the a tag) within each li. I know using the float property on elements that are not the same width and height may cause gaps between the elements, hence the ugly gaps and jumps in my original code.