I'm working on a bootstrap template, I created a div class with a logo, but when I tight the window of chrome, the logo is up above the mobile menu.
My site (mobile version)
*What I want the mobile version of my site to look like**
My code:
<div class="logo">
<img src="img/bulls-logo.png" class="img-responsive" width="500px" height="100px">
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><i class="fa fa-home" aria-hidden="true"></i> HOME<span class="sr-only">(current)</span></li>
<li class="dropdown">
<i class="fa fa-users" aria-hidden="true"></i> ATLETI<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-calendar" aria-hidden="true"></i> CALENDARIO GARE<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="active"><a href="#">
<i class="fa fa-plus" aria-hidden="true"></i> AFFILIAZIONI<span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<i class="fa fa-star" aria-hidden="true"></i> RISULTATI <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="active"><a href="#">
<i class="fa fa-phone" aria-hidden="true"></i> CONTATTI<span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<i class="fa fa-cart-plus" aria-hidden="true"></i> SHOP<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
CSS:
.logo
{background-color: #FFF;
height: auto;
width: 100%;
padding-bottom: 10px;}
.navbar
{margin-bottom:0px !important;
font-size: 12px;
: #000;}
If you want that your logo be inside your navbar, you should put your logo inside html code of the navbar.
Try to add this line inside your navbar header (and change img path):
<img src="path/to/your/image.jpg">
and add some classes to your extra logo div
<div class="logo">
<img src="img/bulls-logo.png" class="img-responsive hidden-xs" width="500px" height="100px">
</div>
EDITED example :
<div class="logo">
<img src="img/bulls-logo.png" class="img-responsive hidden-xs" width="500px" height="100px">
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<img src="path/to/your/image.jpg">
<button type="button" class="navbar-toggle collapsed navbar-left" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><i class="fa fa-home" aria-hidden="true"></i> HOME<span class="sr-only">(current)</span></li>
<li class="dropdown">
<i class="fa fa-users" aria-hidden="true"></i> ATLETI<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="dropdown">
<i class="fa fa-calendar" aria-hidden="true"></i> CALENDARIO GARE<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="active"><a href="#">
<i class="fa fa-plus" aria-hidden="true"></i> AFFILIAZIONI<span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<i class="fa fa-star" aria-hidden="true"></i> RISULTATI <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="active"><a href="#">
<i class="fa fa-phone" aria-hidden="true"></i> CONTATTI<span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<i class="fa fa-cart-plus" aria-hidden="true"></i> SHOP<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
I don't know, when this mobile view comes, so you have to edit the px. In my example the view is showed, when the width is below 720px.
#media (max-width: 720px) {
.logo{
width: 50%;
float: left;
}
.logo img{
width: 100%;
float: none;
}
}
And in the headtag of your html-file you have to add:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Related
I'm having a problem with the text-center class of bootstrap not working, here is it.
I have a div that contains several list and other tags, but when I apply the text-center class to make this center on the screen it does nothing, this applies also in a div that contains divs in shapes, here is my code:
<div class="col-md-12 options-bar text-center">
<ul class="nav nav-pills">
<li class="normal-li">Ordenar por: </li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Status <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Clientes <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Fecha <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Productos <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
AsignaciĆ³n <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="normal-li">Ver por: </li>
<li><input type="radio"><label style="color: rgb(46, 116, 241 );">Solicitud</label></li>
<li><input type="radio"><label style="color: rgb(46, 116, 241 );">Producto</label></li>
<li id="clock"><span class="glyphicon glyphicon-time"></span></li>
<li>
<input type="text" class="form-control" placeholder="Buscar solicitudes">
</li>
</ul>
</div>
As you can see my div with class options-bar is the one that contains the rest, but the class text-center does nothing.
Here is my css stylesheet for options-bar:
.options-bar {
line-height: 50px;
width: 100%;
}
You may use this for centering div's. Add the below code to the div that you want to center.
.centered {
margin: 0 auto;
}
Note: Usually div's occupy entire width(since its a block element). Make sure that the div which you want to center has width lesser than the screen width. Otherwise you may not see any difference.
You can set the .nav.nav-pills li items to flex-grow: 1; which will cause all the list items to expand equally to fill the space. See this fiddle for an example. I also added a snippet below, but it only looks right in full-screen.
.options-bar {
line-height: 50px;
width: 100%;
}
.nav.nav-pills li {
flex-grow: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<div class="col-md-12 options-bar text-center">
<ul class="nav nav-pills">
<li class="normal-li">Ordenar por: </li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Status <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Clientes <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Fecha <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
Productos <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
AsignaciĆ³n <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="normal-li">Ver por: </li>
<li>
<input type="radio">
<label style="color: rgb(46, 116, 241 );">Solicitud</label>
</li>
<li>
<input type="radio">
<label style="color: rgb(46, 116, 241 );">Producto</label>
</li>
<li id="clock"><span class="glyphicon glyphicon-time"></span></li>
<li>
<input type="text" class="form-control" placeholder="Buscar solicitudes">
</li>
</ul>
</div>
Try this css class in your divs:
.vertCenter {
display: flex;
justify-content: center;
align-items: center;
I'm trying to add offcanvas to my bootstrap navigation, the responsive works perfectly but the dropdown menu doesn't work when i try the desktop resolution.
The problem seems to be the "bootstrap.offcanvas.js".
When I delete the "bootstrap.offcanvas.js", it works.
Any idea to resolve this problem?
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container menu-height">
<div class="navbar-header">
<button type="button" class="navbar-toggle offcanvas-toggle pull-right" data-toggle="offcanvas" data-target="#js-bootstrap-offcanvas">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<object width="98px" data="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" title="xxxxxxxxxxxxxxxxxxxxxxxxxxxx" type="image/svg+xml"></object>
</div>
<!--/.navbar-header -->
<div class="navbar-offcanvas" id="js-bootstrap-offcanvas">
<ul class="nav navbar-nav">
<li class="dropdown">
xxxxxxxxx <b class="caret"></b>
<ul class="dropdown-menu" >
<li>xxxxx</li>
<li class="divider"></li>
<li>xxxxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxxxxx</li>
</ul>
</li>
<li class="dropdown">
xxxxxxxxx<b class="caret"></b>
<ul class="dropdown-menu">
<li>xxxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxxx</li>
</ul>
</li>
<li class="dropdown">
xxxxx <b class="caret"></b>
<ul class="dropdown-menu">
<li>xxxxxx</li>
<li class="divider"></li>
<li>xxxxxx</li>
<li class="divider"></li>
<li>xxxx</li>
<li class="divider"></li>
<li>xxxxxxx</li>
<li class="divider"></li>
<li>xxxxxxx</li>
<li class="divider"></li>
<li>xxxxxx</li>
<li class="divider"></li>
<li>xxxxxxx</li>
<li class="divider"></li>
<li>xxxxxx</li>
</ul>
</li>
<li class="responsive-online-shop"><div class="box-online-shop"><a class="nav-link btn btn-secondary-outline btn-secondary" href="xxxxxx">xxxxxx</a></div></li>
<li><div class="box-online-flag"><object data="xxxxxxxxxxxxx" type="image/svg+xml"></object><span class="flag-responsive hidden-lg">xxxxxxx</span></div></li>
</ul>
</div>
<!--/.navbar-collapse -->
</div>
</nav>
<
<nav class="navbar navbar-default navbar-offcanvas navbar-offcanvas-touch" role="navigation" id="js-bootstrap-offcanvas">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Brand</a>
</div>
<div>
<ul class="nav navbar-nav">
<li class="active">Link</li>
<li>Link</li>
<li class="dropdown">
Another Link <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
<li class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
<li class="dropdown">
Another Link <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
<li class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>Link</li>
<li>Another Link</li>
</ul>
</div>
</div>
</nav>
</header>
nav class="navbar navbar-default navbar-offcanvas navbar-offcanvas-touch" role="navigation" id="js-bootstrap-offcanvas">
Brand
Link
Link
Another Link
Action
Another action
Something else here
Separated link
One more separated link
Another Link
Action
Another action
Something else here
Separated link
One more separated link
Submit
Link
Another Link
I am a new web designer and I am struggling right now in designing a responsive navbar in bootstrap with the proper icons. Could you please tell me which icons I should use for the following menu options?
Here's my HTML Code:
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">
<a href="#">
<i class="glyphicon glyphicon-home"></i> Home</a></li>
<li>Services</li>
<li>Time Series</li>
<li>Profile</li>
<li>Place Order</li>
<li>FAQ</li>
<li>About</li>
<li>Contact</li>
<li class="dropdown">
Admin <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
First time I see a request like this .. You're the designer, you should do whatever you want and don't need advices from others.
But since you asked it, here something you could start with : http://www.bootply.com/jePKaJ3ebg
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">
<a href="#">
<i class="glyphicon glyphicon-home"></i> Home</a></li>
<li><i class="glyphicon glyphicon-th"></i> Services</li>
<li><i class="glyphicon glyphicon-calendar"></i> Timeline</li>
<li><i class="glyphicon glyphicon-user"></i> Profile</li>
<li><i class="glyphicon glyphicon-inbox"></i> Place a Request</li>
<li><i class="glyphicon glyphicon-question-sign"></i> FAQ</li>
<li><i class="glyphicon glyphicon-info-sign"></i> About</li>
<li><i class="glyphicon glyphicon-envelope"></i> Contact</li>
<li class="dropdown">
<i class="glyphicon glyphicon-wrench"></i> Admin <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
<li class="dropdown">
<i class="glyphicon glyphicon-bullhorn"></i> Support <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
And as I commented, you could use Font Awesome Icons to get a wider catalog, and IMO they are better designed than Bootstrap's glyphicons.
I have a navbar with a couple of dropdowns. They have been modified to use a container to display 4 columns of dropdown content
Notice that for each dropdown on the navbar, the dropdown menu is not alligned with the container (gray area). I would like to have all dropdowns aligned with the container.
I tried absolute positioning this but it didn't work very well, and I'm wondering if there's a better bootstrap way of doing it?
code:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown"
role="button" aria-haspopup="true"
aria-expanded="false">
Dropdown 1 <span class="caret"></span>
</a>
<div class="dropdown-menu">
<div class="container">
<div class="row">
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-haspopup="true"
aria-expanded="false">
Dropdown 1 <span class="caret"></span>
</a>
<div class="dropdown-menu">
<div class="container">
<div class="row">
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
<div class="col-lg-3">
<ul class="list-unstyled">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</nav>
Each your dropdown-menu contains <div class="container"> which has fixed width corresponding to screen size.
You should manually set container width: <div class="container" style="width:...">
Or create css class for each screen size <div class="container custom-width">:
#media (min-width: 768px) {
.custom-width {
width: ... !important;
}
}
#media (min-width: 992px) {
.custom-width {
width: ... !important;
}
}
#media (min-width: 1200px) {
.custom-width {
width: ... !important;
}
}
I'm trying to achieve a nav menu similar to the examples but with a split-button drop-down:
"Tabs with dropdowns"
http://twitter.github.io/bootstrap/components.html#navs
http://twitter.github.io/bootstrap/components.html#navbar
I can have a split button, or I can have a tab with a dropdown, but I can't seem to combine the two. Is this possible?
Tabs with dropdowns:
<div class="">
<ul class="nav nav-tabs">
<li class="active">Home</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Tab2 <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Tab3<b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div>
Split Button:
<div class="btn-toolbar" style="margin: 0;">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</div>
</div>
So your final result should be a split button instead of a dropdown, correct? Did you try this? (didn't test it)
<div>
<ul class="nav nav-tabs">
<li class="active">
<button class="btn dropdown-toggle" data-toggle="dropdown">Home<span class="caret"></span></button>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div>
I've got it near enough now - just need to change the styles a bit.
Here's the HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="content/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="content/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container tabbable">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#">ProjectName</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active tabbable">tab1</li>
<li class="tabbable">tab2</li>
<li class="tabbable" id="tabarea3">
<!--<div class="btn-group" data-toggle="buttons-radio">-->
<div class="btn-group">
<a class="btn" id="tab3" href="#tab3" data-toggle="tab">Tab3</a>
<button id="tab3button" class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="content/bootstrap/js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="content/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="content/bootstrap/js/custom.js" type="text/javascript"></script>
Some jquery to deselect the split-button tab (custom.js):
$(document).ready(function () {
var $tabs = $('.tabbable li');
$tabs.on('click', function (sender) {
if($('#tab3').hasClass('active'))
{
$('#tab3').removeClass('active');
}
});
});