Bootstrap - navbar doesn't work on all screens - html

I'm new and I don't speak english very good but I think that You can understand me and help :). I just started my adventure with bootstrap.
So... my navbar when has only 4 /li/ work with all screen sizes.
Here is the code:
<!-- Navigation -->
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<!-- 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>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="index.html">Business Casual</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>
Home
</li>
<li>
About
</li>
<li>
Blog
</li>
<li>
Contact
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
But the problem is when I modify navbar and add for example 2 more /li/ like this:
<!-- Navigation -->
<nav class="navbar navbar-default " role="navigation">
<div class="container">
<!-- 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="#">Health</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>
Main menu
</li>
<li>
<a href="#>Doctors</a>
</li>
<li>
Presciprions
</li>
#if(Auth::check())
<li>
Panel
</li>
<li>
Logout
</li>
#else
<li>
Login
</li>
<li>
Register
</li>
#endif
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
My navbar is not responsive with screen between 768 and 992 / and / 992 and 1200. I think, because It doesnt work on Tablets and my navbar is curling - I would like to be always on one line, no matter witch size screen is. Where is my mistake?
Link to page

Please add this code to your custom file css
#media screen (min-width: 768px) and (max-width:1200){
.nav>li>a {
padding: 36px 5px;
}
}

Related

Bootstrap 4 HTML Navbar Icon Text

Guys I am trying to get my head around the navbar and I cant for the life of me work this one out
I use the following code to make the navbar
<!-- Fixed navbar -->
<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 navbar-toggler-right custom-toggler" style="color: rgb(255, 255, 255); align-self: auto;" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
Menu<span class="navbar-toggler-icon"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Barr Custom Printing</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 navbar-right">
<li>Home</li>
<li>About</li>
<li class="dropdown">
Garments <span class="caret"></span>
<ul class="dropdown-menu">
<li>T-Shirt</li>
<li>Sweatshirt</li>
<li>Polo Shirt</li>
<li>Hoodies</li>
<li>Sports Vests</li>
<li>Oversize</li>
<li>Organic</li>
<li>Sublimation</li>
</ul>
</li>
<li>Pricing</li>
<li>Contact Us</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
This results in the following image on the left
Any Idea how I get it to look like the one on the right
I have tried mucking about with the CSS but just don't know what to try
Any Help Appreciated
Mark
So here it is. I used flexbox to align items.
just add following html
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle navbar-toggler-right custom-toggler" style="color: rgb(255, 255, 255); align-self: auto;" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="text">Menu</span>
<div class="iconWrapper">
<span class="navbar-toggler-icon"> </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</div>
</button>
<a class="navbar-brand" href="#">Barr Custom Printing</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
And the following css :-
.custom-toggler {
display: flex;
align-items: center;
}
.text {
margin-right: 10px;
}
Live example :-
https://jsfiddle.net/DTcHh/67566/

Navbar toggle collapse

Why my button doesn't want to work when browser window collapsed? I mean once hamburger menu button is clicked no menu appears.
Here is my HTML:
<html>
<head>
</head>
<body>
<!-- Navbar style available in Bootstrap framework-->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- /end-->
<!-- Anything that has to be responsive we are going to keep inside the Bootstrap grid -->
<div class="container">
<!-- /end -->
<div class="navbar-header">
<button type="button" class="navbar-toggle btn-lg" data-toggle="collapse" data-target=".navbar-collapse" id="btnnavbar">
<!-- For screen readers only -->
<span class="sr-only">Toggle navigation</span>
<!-- /end -->
<!-- Hamburger menu button appears when browser window has been shrinked -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- /end -->
<!-- Brand and toggle get grouped for better mobile display -->
<a class="navbar-brand" href="http://codepen.io/ekilja01"><img id="imgbrand" src="http://www.kiljakandweb.com/favicon.png" alt="brand logo"></a>
</div>
I guess everyone is fine until this point
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active" id="btnhome">About</li>
<li id="btnhome">Portfolio</li>
<li id="btnhome">Contact</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>

Aligning bootstrap navbar to the bottom center of the screen - landing page

I am using a bootstrap template, and I cannot for the life of me figure out how to get my navbar text to get to the bottom-center of the screen. I have tried editing the bootstrap css for .navbar, .navbar-right, etc with vertical-align: bottom. It stays at the top no matter what.
Here is a link to the bootstrap template http://startbootstrap.com/template-overviews/landing-page/
And here is the code:
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- 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 topnav" href="#">Start Bootstrap</a> -->
<img src="img/RyanIsGreat.png" width=200px height=100px>
</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" >
<!--Here is what I am trying to bottom-center align
The about, services, and contacts all appear
on the right, as is shown in the image-->
<li>
About
</li>
<li>
Services
</li>
<li>
Contact
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
Use the navbar-fixed-bottom class..
<nav class="navbar navbar-default navbar-fixed-bottom topnav" role="navigation">
<div class="container topnav">
...
http://www.codeply.com/go/RBR3Hsg5bH

Navbar buttons are left aligned and stack on smaller resolutions

I'm having some issues with my Navbar. It collapses on <768px but from 768 onwards it will do this stupid thing until it can fill the page properly:
I have tried entering nav-justified to the HTML but it just stacks each button.
Ideally I'm looking for any solution that doesn't look stupid, but unfortunately I need to leave every single link on this menu so even culling some isn't an option.
I think best bet would be to have it all center align so that if it has to stack it is at least in the middle.
Anyone else had this issue before?
Here are a few ways to solve this problem.
1) Reduce the font size
2) Utilize dropdown menus.
3) Add another (permanently exposed) bar for frequent/common links.
See working example.
.navbar.navbar-custom,
.navbar.navbar-custom2,
.navbar.navbar-custom3 {
background: white;
border-radius: 0;
border: none;
border-bottom: 3px solid red;
}
/**NAV One**/
.navbar.navbar-custom .navbar-nav > li > a {
font-size: 12px;
}
/**NAV Three**/
.navbar-default.nav-top {
background: white;
border-top: 3px solid red;
}
.navbar-default.nav-top ul {
display: inline-block;
float: right;
}
.navbar-default .navbar-top li {
float: left;
font-size: 12px;
}
.navbar-default .navbar-top li a {
color: #555;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-custom">
<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-nv1" 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> <a class="navbar-brand" href="#">NAV 1</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-nv1">
<ul class="nav navbar-nav">
<li>HOME
</li>
<li>TRAINING
</li>
<li>HEALTH
</li>
<li>SAFETY
</li>
<li>TRAINING CALENDAR
</li>
<li>ABOUT
</li>
<li>CONTACT
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<hr>
<div class="alert alert-info">NAV One + Smaller Text</div>
<nav class="navbar navbar-default navbar-custom2">
<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-nv2" 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> <a class="navbar-brand" href="#">NAV 2</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-nv2">
<ul class="nav navbar-nav">
<li>HOME
</li>
<li>TRAINING CALENDAR
</li>
<li>ABOUT
</li>
<li>CONTACT
</li>
<li class="dropdown"> SERVICES <span class="caret"></span>
<ul class="dropdown-menu">
<li>TRAINING
</li>
<li>HEALTH
</li>
<li>SAFETY
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<hr>
<div class="alert alert-danger">NAV Two + Dropdown</div>
<nav class="navbar-default nav-top">
<div class="container-fluid">
<ul class="nav navbar-top">
<li>ABOUT
</li>
<li>CONTACT
</li>
</ul>
</div>
</nav>
<nav class="navbar navbar-default navbar-custom3">
<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-nv3" 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> <a class="navbar-brand" href="#">NAV 3</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-nv3">
<ul class="nav navbar-nav">
<li>HOME
</li>
<li>TRAINING
</li>
<li>HEALTH
</li>
<li>SAFETY
</li>
<li>TRAINING CALENDAR
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<hr>
<div class="alert alert-warning">NAV Three + Upper Links</div>
Would it be as simple as changing the #media queries higher like maybe around 800-900? Then change it to dropdown menu as suggested by vanburenx?

Twitter Bootstrap: Drop down menu disappears in mobile view

The navbar that I have managed to create is working just fine. However, when I collapse the navbar by re-sizing the window it disappears as I try to open the menu in that view.
Why is the drop-down menu disappearing in mobile view. What am I doing wrong?
HTML code:
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<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">
<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 page-scroll" href="#page-top">Kirori Mal College</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 navbar-right">
<li class="dropdown">
Why Recruit? <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Why Recruit?</li>
<li>Demographics</li>
<li>Faculty</li>
<li>Academics</li>
<li>Alumni</li>
</ul>
</li>
<!-- End of nav bar tabs -->
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
Link to Website and
Link to CSS file.