I am using Bootstrap v3 for a layout and have added a dropdown to the navbar but when I add btn-primary the text is black so cannot be seen, if I remove the btn-primary then the corner radius seems to overlap the menu.
Any help is appreciated.
<div class="container">
<div class="col-md-12 column">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="Javascript:void(0);">Title Information </a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown btn-primary">
<a class="dropdown-toggle btn-primary" href="Javascript:void(0);" data-toggle="dropdown">Actions<strong class="caret"></strong></a>
<ul class="dropdown-menu">
<li>
Action 1
</li>
<li>
Action 2
</li>
<li>
Action 3
</li>
<li class="divider"></li>
<li>
Close
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div role="tabpanel" class="col-md-12 column">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Home</li>
<li role="presentation">Profile</li>
<li role="presentation">Messages</li>
<li role="presentation">Settings</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">...</div>
<div role="tabpanel" class="tab-pane" id="profile">...</div>
<div role="tabpanel" class="tab-pane" id="messages">...</div>
<div role="tabpanel" class="tab-pane" id="settings">...</div>
</div>
</div>
</div>
</div>
</div>
some images:
https://www.dropbox.com/s/fuirgtcfc0obl04/Image1.JPG?dl=0
https://www.dropbox.com/s/en0vooc1z99hbkh/Image2.JPG?dl=0
Take out the "btn-primary" but change it to "btn" only, that should fix it.
Remove both btn-primary classes, as these aren't required.
You also have </div> and </nav> closing in the wrong order, and two extra </div> at the bottom of your code.
With the btn-primary removed, and the above fixed, then you get the following:
https://jsfiddle.net/9jym0k8r/
You can customize the style of bootstrap button.
I just added this to change the color of text :
.navbar-default .navbar-nav>li>a {
color: #FFF;
}
Link Demo : http://www.bootply.com/Ukp9KCUuFP
You can also give an "unique id" then customize the style for this button.
<a id="test" class="dropdown-toggle btn-primary" href="Javascript:void(0);" data-toggle="dropdown">Actions<strong class="caret"></strong></a>
css:
#test {
color:white;
}
#test:hover{
color:black;
}
Link : http://www.bootply.com/XWF4x6uhmz
Related
I'm trying to organize the way Sonata Admin shows sonata_type_collection.
It looks like this now:
In the source html code I see that all of that is meant to be tabs
<div class="sonata-ba-tabs">
<div>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#s5860de8a43681_1_1" data-toggle="tab">
<i class="icon-exclamation-sign has-errors hide"></i> -
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="s5860de8a43681_1_1">
<fieldset>
<!--some field here-->
</fieldset>
</div>
</div>
</div>
</div>
<div>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#s5860de8a43681_2_1" data-toggle="tab">
<i class="icon-exclamation-sign has-errors hide"></i> -
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="s5860de8a43681_2_1">
<fieldset>
<!--some field here-->
</fieldset>
</div>
</div>
</div>
</div>
</div>
(I omitted some code to make it shorter)
We can definitely see that it is meant to be some kind of jquery tabs, but I can't really find any information how to make that work like a tabs. Is there anyway to configure the form to implement that?
On the picture is right side of my site. Some elements out from bootstrap grid.
<div class="container">
<div class="col-md-12">
<div class="row">
First
<nav class="main_menu clearfix">
<button class="main_menu_button hidden-md hidden-lg"><i class="fa fa-bars"></i></button>
<ul>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</nav>
</div>
</div>
</div>
Why element nav can out from bootstrap grid? My main part is gray
Not really sure what is wrong with your markup or style, it's hard to understand from the given content, but you should put .col-md-12 inside of .row not the other way around.
Here are some examples: https://getbootstrap.com/examples/grid/
I would definitely familiarize yourself with how the HTML and CSS classes should be structured with bootstrap. You will need to start with a container class(eg. class="container"). Inside the container goes rows (class="row"), and inside the rows is your columns(eg. class="col-md-12").
Check out this page: http://getbootstrap.com/css/
If you are looking to build a nav out in bootstrap you do not necessarily need to re-invent the wheel and can use their Navbar Template: http://getbootstrap.com/examples/navbar/
Possibly something like this would work for you:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-xs-3">
First
</div>
<div class="col-xs-9">
<nav class="main_menu clearfix">
<button class="main_menu_button hidden-md hidden-lg">menu</button>
<ul>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
You should try using bootstrap4 class.
<nav class="navbar navbar-expand-md navbar-light bg-light">
<a class="brand" href="#">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="nav navbar">
<li class="nav-item"><a class="nav-link" href="#">Home</li>
<li class="nav-item"><a class="nav-link" href="#">career</li>
<li class="nav-item"><a class="nav-link" href="#">Contact</li>
<li class="nav-item"><a class="nav-link" href="#">about</li>
</ul>
</div>
</nav>
in case of you want to have vertical navigation then in nav tag remove the navbar-expand class.
I have a Foundation 5 based site with a nav bar at the top.
Because my menu choices are larger text they overlap the left "Name" section when the screen is made narrower.
Is there a way to control when the nav menu slips into mobile style?
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<div class="logo">
<a href="#">
<img src="mylogo.png"/>
</a>
</div>
</li>
<li class="toggle-topbar menu-icon">
<a href="#">
<span></span>
</a>
</li>
</ul>
<section class="top-bar-section hide-for-medium-down ">
<!-- Right Nav Section -->
<ul class="right">
<li class="active">
<a href="/home/index" class="menuMix">
#*<span class="menuMinor">Home Page</span>*#
<span class="menuMain allCaps">Home</span>
</a>
</li>
<li class="">
<a href="/home/about" class="menuMix">
#*<span class="menuMinor">Who We Are</span>*#
<span class="menuMain allCaps">About</span>
</a>
</li>
<li class="">
<a href="/home/contact" class="menuMix">
#*<span class="menuMinor">Get In Touch</span>*#
<span class="menuMain allCaps">Contact</span>
</a>
</li>
</ul>
</section>
</nav>
If you use SCSS you can try to decrease
$topbar-link-weight: $font-weight-normal;
$topbar-link-font-size: rem-calc(13);
I have got a problem with rows which are overlapping in this following code:
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="navbar navbar-fixed-top ">
<a class="navbar-brand" rel="home" href="#" title="Buy Sell Rent Everyting">
Site.com
</a>
<ul class="nav navbar-nav navbar-right">
<li>Contact Us</li>
<li>NL</li>
<li>ENG</li>
<li>SP</li>
</ul>
</div>
</div>
</div>
</div>
</header>
<div class="row">
<div class="col-md-6"><h1>This is my header</h1></div>
<div class="col-md-6"><img src="img/MyPicture.JPG" height="300"></div>
</div>
In my browser the last rows lies over the navbar. Could it be that it has got something to do with the second row being outside the container? If so where should I define the container.
Here is the jsfiddle text: http://jsfiddle.net/L9GJE/
Wrap <div class="row"> with a <div class="container">
e.g.
<div class="container">
<div class="row">
....
</div>
</div>
So whenever you use the navbar you'll need to keep in mind that it is fixed and you will need to add margin or padding from the top so your rows won't overlap.
Your navbar is fixed, so, you need to add margin-top to second row.
Your navbar was not made correctly, here is the correct usage of the navbar class:
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</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">Link</li>
<li>Link</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Link</li>
<li class="dropdown">
Dropdown <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>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="container">
<div class="row">
<div class="col-md-6">
<h1>This is my header</h1>
</div>
<div class="col-md-6">
</div>
</div>
</div>
I would like to open a dropdown menu (using Twitter Bootstrap) everytime I click on the brand of my navbar, so I tried this code:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="tabbable">
<div class="dropdown">
<a id="drop1" class="dropdown-toggle" data-toggle="dropdown" href="#menu">
<div class="brand">Brand</div>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
<li>Action</li>
</ul>
</div>
<ul class="nav">
<li>
Item
</li>
</ul>
</div>
</div>
</div>
Result: when I click on it, the menu appears, but it's over the brand, not under. How to fix it?
Examples
Standard version [OK]: http://jsfiddle.net/4rdPU/2/
Standard version + div class="brand" [Style problem]: http://jsfiddle.net/4rdPU/1/
Brand version [Wrong menu position]: http://jsfiddle.net/4rdPU/3/
To properly render the dropdown, your brand must be a .nav li element. So just add the .brand class to a standard dropdown.
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="tabbable">
<ul class="nav">
<li class="dropdown">
<a id="drop1" class="dropdown-toggle brand" data-toggle="dropdown" href="#menu">
Brand
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
<li>Action</li>
</ul>
</li>
<li>
Item
</li>
</ul>
</div>
</div>
</div>
That will break your brand positioning, but you fan fix it with this simple CSS:
.navbar .brand {
margin-left: 10px; /* This value could be different for another layout */
}