I've been playing around with this for a while and thought it's time to seek help.
I have a container and within it there is a link and below the link there is a label and below that is the nav bar.
I tried a few of the settings but haven't been able to get it right.
For a moment I thought I had it.
[EDITED] Here is the code that i've been mucking around:
<div style=" background-color:#f0f0f1; width:inherit;">
<div class="container">
<!--Page Title Section -->
<div class="container">
<div style="float:left;">
<br />
Back to Link
<p class="pagelabelspacer">
<asp:Label ID="PageTitleLabel" CssClass="pageTitle" runat="server">Page Title.</asp:Label>
</p>
</div>
</div><!-- /.container-collapse -->
</div>
<!--End Page Title Section-->
<!--Nav Bar -->
<div class="container">
<nav class="navbar navbar-inverse navbar-default">
<div class="navbar-header">
<button type="button" 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>
</button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Link 1</li>
<li>Link 1</li>
<li>Link 1</li>
</ul>
</div>
</nav>
</div>
<!--End Nav Bar -->
</div>
[EDITED] My questions:
How do i get the nav bar not to overlap the link and label?
[My answer -> just put it in another container and it works]
On nav-default the height of the nav bar seems exaggerated (i.e. too high). Is there a way to change it (e.g. setting a specific pixel height)?
Is there a way to override the default nav bar color?
I'll continue playing with it to try to get it working.
Any suggestions and advice are greatly appreciated.
thanks!
How do i get the nav bar not to overlap the link and label?
http://getbootstrap.com/components/#navbar-fixed-bottom
Body padding required
The fixed navbar will overlay your other content, unless you add padding to the bottom of the . Try out your own values or use
our snippet below. Tip: By default, the navbar is 50px high.
body { padding-bottom: 70px; }
Make sure to include this after the core Bootstrap CSS.
Is there a way to override the default nav color?
http://getbootstrap.com/customize/#navbar
If you're using SASS or LESS bootstrap, has variables that you can change to manipulate various properties of elements.
Related
Can somebody explain what is going on here?
I'm using bootstrap 3.3.7.
Why are .container elements invisible?
<!-- Navbar -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-header">
<a class="navbar-brand" href="#">Big Brother</a>
</div>
<div class="navbar-collapse">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Messages</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>something</li>
</ul>
</div>
</div>
<div class="container">
<h2>Invisible</h2>
</div>
Your <h2> is not invisible, it's hiding behind your navbar.
You're using a navbar that uses fixed positioning. This takes it out of the normal document flow where it doesn't take up space so the elements after it begin to flow as if it wasn't there.
If you add padding-top: 50px; to <body> you will see your <h2>.
If you read through the Bootstrap Navbar Docs you'll notice a callout that says Body padding required.
I'd like to change my css so that the page has the bottom menu stay there (like fixed) but without the position:fixed.
Why?
Indeed, using Boostrap 3, I am using navbar-fixed-bottom .
BUT position:fixed is not supported at all on Opera Mini which accounts for 10% almost of mobile browsers (see here).
how can I create this without position:fixed ?
3 constraints:
I never want any scroll: it means if the viewport gets smaller(no matter the size of the viewport: big, small, desktop, tablet...), the menu and image will just get smaller and never any horizontal nor vertical scrollbar.
and I want the menu to stay below the image (the quality of the image, distorted or not, is not my point in this question).
i want only html and css: no javascript nor jquery. thanks
Here is an example of what I would like to do:
Here is my current code using fixed position:
<div>
<nav role="navigation" class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<!-- Title -->
<div class="navbar-bottom pull-left">
BIGGA
</div>
<!-- The non-Collapsing items on navbar-LEFT -->
<div class="collapse navbar-collapse navbar-left">
<!-- pull-right keeps the drop-down in line -->
<ul class="nav navbar-nav pull-right">
<li>
News
</li>
</ul>
</div>
<!-- 'Sticky' (non-collapsing) right-side menu item(s) -->
<div class="navbar-bottom pull-right">
<ul class="nav pull-left">
<!-- This works well for static text, like a username -->
<li class="navbar-text pull-left">User Name</li>
<!-- Add any additional bootstrap header items. This is a drop-down from an icon -->
<li class="dropup pull-right"> <span class="glyphicon glyphicon-user"></span><b class="caret"></b>
<ul class="dropdown-menu">
<li> Profile
</li>
<li> Logout
</li>
</ul>
</li>
</ul>
<!-- Required bootstrap placeholder for the collapsed menu -->
<button type="button" data-toggle="collapse" data-target=".navbar-collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
</div>
<!-- Additional navbar items on the LEFT of the PULL-RIGHT stuff above -->
<div class="collapse navbar-collapse navbar-right">
<!-- pull-right keeps the drop-down in line -->
<ul class="nav navbar-nav pull-right">
<li>Locator
</li>
<li>Extras
</li>
</ul>
</div>
</div>
</nav>
</div>
I will give you an idea, about how it could be solved.
Use 2 divs, one after the other. The 1st div will contain your image, or whatever you want to put in the main content area. Its height is 90%, of course you can change or modify that. The second div is your menubar, the height is 10%, modify it as per your needs. Notice the overflow:auto in the .image_content class, it will contain your main contents, regardless of its length and keep the menubar at the bottom.
<style>
.main_wrapper {
height:100%;
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
z-index:9999;
}
.image_content {
height:90%;
background:red;
overflow:auto;
}
.bottom_menu {
height:10%;
background:blue;
}
</style>
<div class="main_wrapper">
<div class="image_content">
Your main content here
</div>
<div class="bottom_menu">
Menu here
</div>
</div>
Of course, remove the red and blue colors from the divs, they are just for the testing.
Added the following image to better explain what is going on in my code -
Ok, So I am creating a website with Bootstrap and I have run into an issue. I have placed an image in the nav bar in the logo and then I go to resize the browser to force mobile layout. When I get to where the image should start re-sizing, it drops below (or above) the menu toggle before re-sizing.
I have even tried adding .img-responsive to it but that is no help.
Here is an image of what I am talking about:
And here is my code:
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" 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>
</button>
<a class="navbar-brand" href="#"><img src="http://lorempixel.com/300/40/" class="img-responsive" alt="LOGO"></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="text-center">
<h1>Bootstrap starter template</h1>
<p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>
</div>
</div><!-- /.container -->
Any help would be appreciated
Thanks.
There are several ways to solve this. You can use media queries to set max-width or percentage width to .navbar-brand.
The clearest solution might be to use CSS3 calc to make it take 100% width minus the space that the menu button is taking (22px width + 20px of padding + 2px of border + 15px of margin = 59px total space). And because your image is pushed down at 390px screen width, your media query should be:
#media (max-width: 390px) {
.navbar-brand {
width: calc(100% - 59px);
}
}
Check the JSFiddle with the result.
My other answer might help you as well.
I have a div space at the top of my page that holds a logo and a tagline. Directly underneath it is a responsive fixed navbar (twitter bootstrap 3). When my window is minimized, the top div becomes responsive and increases it's height, but the fixed navbar below it does not respect it's increase in height (and stays in the same place).
How can I get the fixed navbar to allow the top div to allow it's height increase space?
This is what is happening:
<div class="welcometop" >
<div class="container-fluid">
<div class="row">
<div class="col-md-1 col-md-offset-1"><img src="/images/citylightslogo.png" alt="logo" id="cllogo"/></div>
<div class="col-md-7 col-md-offset-1">
<h1 id="headline33" > 100% Satisfaction Guaranteed!</h1><h1 id="headline24" > Call Anytime! (888) 777-6666 </h1>
</div>
</div>
</div>
</div> <!-- Close Welcome Top -->
<div class=" navbar navbar-default navbar-fixed-top " role="navigation">
<nav 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="#midnav">
<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="midnav">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Office</li>
<li>Reviews</li>
<li>Find us on Angie's List</li>
<li><a href="/>Yelp</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div><!-- /.navbar-default -->
Do not give any top value. In bootstrap, top:0; is given. To override it use
.navbar-fixed-top {
top: auto;
}
Hence your fixed navbar will always stay just below .welcometop div.
To make .welcometop and .navbar fixed at top try somthing like below.
<div class="welcometop affix" >
<div class="container-fluid">
<!-- codes for top area of navbar -->
</div>
<div class="navbar navbar-default" role="navigation">
<!-- codes for navbar -->
</div>
</div>
Note: remove .navbar-fixed-top class from .navbar. Add .affix to .welcometop
If you want to keep a position: fixed for the navbar, you'll have :
either to add a margin-top (or padding-top) to your content of the same height than the navbar,
or to create a void div below (= with a lower z-index) the navbar of the same height with a position: relative or no defined position (= inherit).
EDIT : I forgot, in case your content has a position absolute, fixed of static, you'll obviously have to manage the top css property of the content.
I'm using twitter bootstrap and I see the image below when I reduce the width of the browser window to a certain size. However, when I click on it and nothing happens. I normally have 2 elements there but can't see them when I width is too small. How do I fix this by either removing the button from showing or have the button show but then show the 2 items on click?
To stop the button from displaying, you may add below code to your css:
.navbar .btn-navbar{
display:none;
}
Additionally , you may go through this article for more information and help..
Make sure you have responsive bootstrap css and the collapse javascript plugin per the bootstrap documentation:
Heads up! The responsive navbar requires the collapse plugin and
responsive Bootstrap CSS file.
Also here is an example of it working (has bootstrap responsive css and bootstrap js referenced):
http://jsfiddle.net/ZdVcg/
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a 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>
</a>
<!-- Be sure to leave the brand out there if you want it shown -->
<a class="brand" href="#">Project name</a>
<!-- Everything you want hidden at 940px or less, place within here -->
<div class="nav-collapse collapse">
<!-- .nav, .navbar-search, .navbar-form, etc -->
<ul class="nav">
<li class="active">Home
</li>
<li>Link</li>
<li>Link</li>
</ul>
</div>
</div>
</div>
</div>