I'm using Bootstrap 3.3.5 to display a footer at the bottom of webpages using the .navbar navbar-default class. On pages which are displaying a list of items greater than 10 the footer is being displayed correctly at the bottom of the page but on pages having less than 5 items then the footer is being displayed at the middle of the page instead of the bottom.
HTML code..
<nav class="navbar navbar-default" style="margin-bottom:0px;padding-botton:0px">
<div class="container-fluid">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbarBottom">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse" id="myNavbarBottom">
<ul class="nav navbar-nav navbar-center">
<li><span class="glyphicon glyphicon-th-large"></span> About</li>
<li><span class="glyphicon glyphicon-pencil"></span> Blog</li>
<li><span class="glyphicon glyphicon-road"></span> How It Works</li>
<li><span class="glyphicon glyphicon-certificate"></span> Credits</li>
<li><span class="glyphicon glyphicon-earphone"></span> Contact</li>
<li><span class="glyphicon glyphicon-comment"></span><b style="color:blue;"> Survey</b></li>
</ul>
</div>
</div>
</nav>
After changing the navbar class to "navbar navbar-default navbar-fixed-bottom" the footer is fixed to the bootom of the page but I'm not able to scroll down to the last item of the list. Please help..
Try this...
.navbar{
position:absolute;
bottom:0;
width:100%;
}
ok so if you want footer to stick on scroll
then
.navbar
{
position: fixed;
bottom: 0;
width: 100%;
}
and if you just want footer
.navbar
{
position: absolute;
bottom: 0;
width: 100%;
}
Related
was hoping for a little help. My Bootstrap navigation is running off the right hand side of the screen? There was a white space on both the right and left sides which I fixed, but now the 'help' link is running off. Any suggestions?
index.html
<div id="header">
<!--CSS deals with header image-->
</div>
<h1>Hands on Sports & Holistic Therapy</h1>
<!--navbar-->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<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="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home<span class="sr-only">(current)
</span></a></li>
<li>Treatments</li>
<li>Bookings</li>
<li>Shop</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Log In</li>
<li>Basket<span class="badge">5</span></li>
<li></li>
<li>Contact</li>
<li>Help</li>
</ul>
</div>
</div>
</nav>
</head>
<body>
cssgeneric.css
#header{
background:url('banner5.jpg') no-repeat top center;
background-size: 95%;
width: 100%;
height: 200px;
margin-top: 50px;
}
#navbar{
background-color: #ccb69b;
margin-left:-20px;
margin-right:-15px;
}`
I can see in the CSS a rule, and I think is possible that is the problem.
#media (min-width: 768px)
navbar.less:380
.navbar-right {
float: right!important;
margin-right: -15px;
}
The margin-right: -15px; is the possible problem. This rule is in navbar.less in bootstrap folder.
In your CSSGeneric.css I change and add new rules.
/*line 76*/
#navbar{
background-color: #ccb69b;
margin-left:-20px;
margin-right:-15px;
}
ul.nav.navbar-nav.navbar-right {
margin-right: 0px;
}
I add the ul.nav.navbar-nav.navbar-right to fix the problem with navbar.less.
I hope that help.
have a good day.
I am using Bootstrap to design a webpage. In that I am using Bootstrap Navbars however I don't want them to be responsive. I tried making changes to variables.less file, adding .container { width: #container-desktop !important; } to my css file but none has worked so far. My code is as follows:
<div class="navbar-custom navbar-default navbar-fixed-top">
<div style="width: 95%; margin:0 auto;" >
<div class="container-fluid">
<a class="navbar-brand" href="http://someURL/"><img src="images/someImage"></a>
<div>
<ul class="nav navbar-nav myCustomClass1">
<li><span class="name">Welcome Mr Blah, Blah </span></li>
<li><span class="logo1">someStuff</span></li>
</ul>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-inverse navbar-fixed-top test">
<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>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<div style="width: 95%; margin:0 auto;" >
<ul class="nav navbar-nav align-nav-items">
<li ng-class="{active: someThing}">aaa</li>
<li>bbb</li>
<li ng-class="{active: someThing}">ccc</li>
<li>ddd</li>
<li>eee</li>
<li>fff</li>
<li>ggg</li>
</ul>
<ul class="nav navbar-nav myCustomClass2">
<li><span class="glyphicon glyphicon-user"></span>xxx</li>
</ul>
<div>
</div>
</div>
</nav>
Please forgive the slightly faulty indentation. The custom css classes are:
.myCustomClass1
{
float: right;
margin:0 auto;
margin-top:1.5%;
}
.myCustomClass2 {
float: right;
margin:0 auto;
}
Is there any way by which I can make such code non-responsive? What I essentially want it to do is instead of responsively changing the design, I want it to get clipped good old fashioned way and make the page horizontally scrollable.
You don't want this in the markup:
<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>
also change
<div class="collapse navbar-collapse" id="myNavbar">
to
<div id="myNavbar">
Change the css for .nav > li and .nav > li > a. Both should be display: block by default (Bootstrap). Change them to display: inline. Style the rest according to your needs.
Edit based on user's JSFiddle:
Is this how you want it? JSFiddle
I've added:
.navbar-inverse {
/* other styles */
height: auto;
overflow-x: auto;
}
.align-nav-items {
min-width: 390px;
}
.nav > li, .nav > li > a {
display: inline;
}
To make navbar non-responsive and all other keep responsive just do the following:
.navbar.navbar-inverse.navbar-fixed-top.test{
min-width: 1200px;/*define as you require*/
}
Can someone have a look to this fiddle http://jsfiddle.net/pkcwtone/1/ and tell me why I am not able to put the image all right inside the navigation?
This is html:
<nav id="mainNavigation" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Responsive navigation -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-2"> <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="">
<img src="http://s28.postimg.org/gc8ajkjq5/advance_logo.png" alt=""/>
</a>
</div>
<div class="clearfix"></div>
<div class="collapse navbar-collapse" id="navbar-collapse-2">
<!-- top navigation-->
<ul class="nav navbar-nav navbar-left">
<li>
Home
</li>
<li>
Accident<br>Management
</li>
<li>
Approved<br>Manufacturers
</li>
<li>
Our<br>Services
</li>
<li>
About<br>Advance
</li>
<li>
Contact<br>Us
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
This is css:
#mainNavigation.navbar-default{
/*background: #f9540a;*/
background:black;
width: 100%;
text-align: center;
font-family:'Droid Sans', sans-serif;
font-weight:700;
font-size:1.2em;
}
#mainNavigation.navbar-header {
float: left;
padding: 15px;
text-align: center;
width: 100%;
}
#mainNavigation .container-fluid{
height:auto;
overflow:auto;
}
.navbar-brand img{
float:left;
}
I've been playing with overflow... with clearfix..... with the height.... but it looks bad :S The text overlays the logo, which it shouldn't (I know I could use padding, but I've though it must be a way more natural to keep in mind the space that the logo occupies), and then, the logo look cut! :S
Anyone can see what am I doing wrong?
Cheers :)
Looks like the issue is here:
#mainNavigation.navbar-header {
what the above css is looking for is a div with id mainNavigation and class nav-header
however you add a space between them, it looks for the class within the mainNavigation:
#mainNavigation .navbar-header {
you will be able to resize the navbar to fit the logo, see the updated jsfiddle:
http://jsfiddle.net/pkcwtone/4/
We are designing a new website, and the designer has created the nav bar as follows, you can see the curve (this is what I'm trying to crack!)
Below is how my current header is
This is my current HTML, I also had to create a new CSS class for the brand so it would appear in the middle of the screen
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#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>
</div>
<a class="navbar-brand" href='#Url.Action("Index", "Home")'>LOGO HERE</a>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li>PRODUCTS</li>
<li>FLAVOUR LAB</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>OUR STORY</li>
<li>VISIT US ON LIFE INVADER</li>
</ul>
</div>
</div>
</nav>
And the css is as follows
.navbar-brand {
position: absolute;
width: 100%;
left: 0;
top: 0;
text-align: center;
margin: auto;
}
When I create a test image and try to apply the style i.e back ground image I get the following output, as you can see the logo with the curve half shows and appears to the left hand side of the screen.
The updated CSS
.navbar-brand {
position: absolute;
width: 100%;
left: 0;
top: 0;
text-align: center;
margin: auto;
background-image: url('/Content/Images/TempLogoExample.png');
background-repeat: no-repeat;
z-index: 9999;
}
I've attached a test Image for anyone that feels they want to have a go at it, any solution/advice would be highly appreciated.
It appears on the left corner because you have set Left:0. try changing that using percentage mark. Eg:- left: 45%;will work in your case. if not try changing the percentage value.
I Recommend to go with a different markup approach to achieve this. Why can't you use columns grid in the main section and then bring your designs internally. Below markup will help you to acheive this.
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<div class="col-xs-4">
<ul class="nav navbar-nav navbar-left">
<li>PRODUCTS</li>
<li>FLAVOUR LAB</li>
</ul>
</div>
<div class="col-xs-4">
<a class="navbar-brand" href='#Url.Action("Index", "Home")'>LOGO HERE</a>
</div>
<div class="col-xs-4">
<ul class="nav navbar-nav navbar-right">
<li>OUR STORY</li>
<li>VISIT US ON LIFE INVADER</li>
</ul>
</div>
</div>
I want to build a bootstrap 3 navbar like the facebook app, with some icons.
The problem is that when the bar its collapsed, all the icons are hidden. If I put the icons outside from <div class="collapse navbar-collapse"> the icons are out and not hidden, but the <ul><li> doen't work and put my icons vertically.
If its possible I want also to align the icons in the center:
Thats all! Thanks friends ;)
EDIT1:
HTML Code
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header"><a class="navbar-brand" href="#">Brand</a>
<span class="glyphicon glyphicon-comment"></span>
<span class="glyphicon glyphicon-edit"></span>
<a class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">Home</li>
<li>Link</li>
<li>More</li>
<li>Options</li>
</ul>
</div>
</div>
CSS Code
.navbar-header .navbar-icon {
line-height:50px;
height:50px;
}
.navbar-header a.navbar-icon {
padding:0 10px;
float:left;
}
JSBin Example
This example is working now. I need to know hw can I align in the center the icons in the mobile responsive version.
In the mobile version, wrap your icons in a div with style text-align:center and remove the float left of your icons.