Bootstrap - Fluid navbar items - css

I'm a newbie bootstrap user, currently I want to create a fluid navigation bar, but when I shrink the browser the navigation bar becomes weird.
Before shrinking:
After shrinking further:
As you can see, the second image is pretty bad.. One possible way I thought is to separate the words into 2 lines (e.g. line 1 - goto, line 2 - Hello_World!). Can anyone give me a better approach for this issue? Thanks in advance.
Current HTML code:
<nav class="navbar navbar-default">
<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 logo-container" href="#"><img class="logo" alt="Logo" src="images/test.png" /></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><span class="code">goto </span><span class="section-name">Hello_World!</span></li>
<li><span class="code">goto </span><span class="section-name">About_Me</span></li>
<li><span class="code">goto </span><span class="section-name">Life_Graph</span></li>
<li><span class="code">goto </span><span class="section-name">Skill_Trees</span></li>
<li><span class="code">goto </span><span class="section-name">Feat_Stacks</span></li>
<li><span class="code">goto </span><span class="section-name">Codetact_Me</span></li>
</ul>
</div>
</div>
</nav>
HERE IS MY FIDDLE...

If my understanding for your quesetion is correct you can use .row & .col to block menu to new row
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="row">
<div class="navbar-header col-sm-1">
...
</div>
<div class="col-sm-11">
<div class="collapse navbar-collapse" id="myNavbar">
...
</div>
</div>
</div>
</div>
</nav>
You can change col-md-xx to make it wider or smaller
for more info
http://getbootstrap.com/css/#grid

Related

Navbar scrolling to fixed top fine working But when browser reloading time scrolling navbar fixed not working useing bootstrap 4?

bootstrap 4 Navbar scrolling to fixed top Working But when Browser reloading time same times mouse scrolling Navbar fixed not working. why not working i'm not understand?
<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="197">
<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="Home"></a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>About</li>
<li>Exam Notic</li>
<li>Student List</li>
<li>Contact Us </li>
</ul>
</div>
</div>
</div>
</nav>

Toggle menu for mobile with bootstrap

I am using bootstrap to make menu upper-right.
For desktop there are four menu shown on the upper-right correctly
If I make browser narrower for mobile environment.
The icon with there line appears, but even I click it, nothing happens.
These are my source code , is there any point???
<div class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a href="/whitebear/web/app_dev.php/" class="navbar-brand">
<img height="30px;" src="/whitebear/web/bundles/acmetop/img/whitebearLogo.png"></a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar-main" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>Nice</li>
<li>Q & A</li>
<li>login</li>
<li><a href="/whitebear/web/app_dev.php/register/" >register</a></li>
</ul>
</div>
</div>
</div>
Add a div to wrap the menu list with id of data-target attribute value(#navbar-main)
<div id="navbar-main" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
// li list
</ul>

div above navbar-fixed-top in bootstrap

I am trying to put a div above navbar-fixed-top in bootstrap, but for some reason the div with its content does not show. I dont know what else to write here, it is asking for detail all is in a code
here is the code
<div class="nav-top">
<div class="container">
<div class="row">
<div class="col-xs-12">fdjfdl;ffd;fjd; fjd;ffffffffffffffffffff
</div>
</div>
</div>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- 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 class="navbar-brand" ><img src="images/logoa.png" alt="need to name it"></div>
</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 navbar-right">
<li class="active">Главная <span class="sr-only">(current)</span></li>
<li>bla</li>
<li>bla</li>
<li>bla</li>
<li>blabla</li>
<li>blablabla</li>
<li class="j">
Обо мне <span class="caret"></span>
<ul class="dropdown-menu">
<li>blu</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
remove your navbar-fixed-top class from code then you get some space to show your text.Have fun
Here is JSFiddle:https://jsfiddle.net/arifkarim/uu0n4cyk/3/
I know this is 4 years late but for anyone else stumbling upon this.
The fixed-top has a z-index of 1030, so just set your own element that you wish to be on top to z-index: 1050 (higher than 1030 at least).

How do I position my navbar?

I am trying to learn bootstrap and so far it has been very fun. I have been stuck on this problem for a while, I want to space my navbar just two fifths of the screen. I think it will look a lot nicer if it is spaced that way but I haven't been able to find a solution. I was wondering if there is any way of doing that.
<nav class="navbar navbar-default navbar-fixed-top">
<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="index.html"><strong>Website</strong></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Products</li>
<li>Contact</li>
</ul>
</div>
</div>
</nav>
You can create a css class:
.adjust-margins-container{
margin-left: 30%;
}
and then add the class to:
<div class="container-fluid adjust-margins-container">
bootply example

put some stuff on the very right of a nav-bar(bootstrap)

I'm using a nav-bar from Bootstrap (http://twitter.github.io/bootstrap/components.html#navbar) apart from the links for different tabs which are on the left side of this nav-bar, I want to put my notification icons on the very right of it. How can I do this with CSS? I dont want to use pixels, I rather have it flexible with the size of window and go to the right of this nav-bar.
thanks
Just use two different UL like on the following code :
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<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>
<div class="nav-collapse collapse">
<ul class="nav">
<li>THREE</li>
<li>LEFT</li>
<li>ITEMS</li>
</ul>
<ul class="nav pull-right">
<li>RIGHT</li>
<li>ITEMS</li>
</ul>
</div>
</div>
</div>
</div>
Link to a bootply : http://bootply.com/69056

Resources