Bootstrap menu bug on desktop - html

The navigation on my desktop version looks fine when I remove the clear from the mobile version. But when I do, the collapsed menu on my mobile version is bugged. Yet I can't seem to set my clear to default in my media query. I've tried float and position:relative but nothing seems to work to get my brand and my navigation on the same line.
#media only screen and(min-width:786px){
.custom-navbar .navbar-collapse {
clear:none;
}
EDIT: here's a minimal 'working' example: Codepen

You need to restructure your HTML. You have your SVG as in lieu of a button, it should be place inside the toggle-button which is then inside the navbar-header, not after. Also, navbar-right belongs with the ul, not navbar-collpase.
See Docs and working Snippet.
body {
font-size: 62.5%;
}
.navbar.custom-navbar .navbar-nav li a {
font-family: 'Open Sans', sans-serif;
color: #DFBA68;
font-size: 1rem;
}
.navbar.custom-navbar {
background-color: #252626;
}
.navbar.custom-navbar .navbar-brand {
font-family: 'sharpie';
color: #DFBA68;
}
.navbar.custom-navbar .navbar-brand:hover {
color: #DFBA68;
}
.navbar.custom-navbar .navbar-toggle {
z-index: 1;
padding: 0;
margin-top: 10px;
margin-left: 15px;
float: left;
}
<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-fixed-top custom-navbar" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
<svg height="30" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M0,40C0,40,100,40,100,40C100,40,100,60,100,60C100,60,0,60,0,60" fill="#f7f4ea"></path>
<path d="M0,20C0,20,100,20,100,20M100,80C100,80,0,80,0,80" stroke="#dfba68" style="stroke-width: 4px;"></path>
</svg>
</button> <a class="navbar-brand" rel="home" title="Help">Hannelore Goovaerts.be</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>ABOUT
</li>
<li>PORTFOLIO
</li>
<li>CONTACT
</li>
</ul>
</div>
</div>
</nav>

Remove clear:both from .custom-navbar .navbar-collapse. clear:both; force an element to be placed in the new line after the elements which have float:right; or float:left;.
Codepen
.custom-navbar .navbar-collapse {
/* clear: both; */
float: none;
}

Related

How would I indent a unordered list in a bootstrap navbar so I can put the navbar-brand first, and then the unordered list

I have tried to use padding, text align-center, float, and margins but nothing seems to work, the list items all remain fixed. Is it a conflict with bootstrap's CSS or JS? I'm very new to bootstrap and relatively new to CSS and HTML so I might have missed something, but I cant seem to find anything else on this problem.
Heres my code (sorry for the messy comments):
/*controls the style of the entire navbar, including border and background clr*/
.navbar.navbar-default {
background-color: #D9D9D9;
border-color: #143DAF;
border-style: groove;
border-width: 5px;
text-align: center;
}
/*Controls the styles of the navbar brand, or the logo in the center*/
.navbar.navbar-default .navbar-brand {
color: #292929;
}
/*IDK, come back later but apears to have something to do with navbar brand hover*/
.navbar.navbar-default .navbar-brand:hover,
.navbar.navbar-default .navbar-brand:focus {
color: #ffffff;
background-color: #ffffff;
}
.navbar .navbar-center > ul {
padding-left: 30px;
padding-right: 30px;
text-align: center;
align-content: center;
float: right;
}
/*Again, IDK what this does, tho i think it is text, pottentially is being overwritten by the one below*/
.navbar.navbar-default .navbar-text {
color: #292929;
background-color: #000000;
}
/*will change the styles of all links within a list and a navbar, including the fb and ig logos*/
.navbar.navbar-default .navbar-nav > li > a {
color: #292929;
}
/*Link styling for when you hover over them*/
.navbar.navbar-default .navbar-nav > li > a:hover,
.navbar.navbar-default .navbar-nav > li > a:focus {
color: #6765eb;
}
/*Changes the color of the links when you hover over them when the active class is equiped*/
.navbar.navbar-default .navbar-nav > .active > a,
.navbar.navbar-default .navbar-nav > .active > a:hover,
.navbar.navbar-default .navbar-nav > .active > a:focus {
color: #6765eb;
background-color: #ffffff;
}
/*changes the color of the links when you hover over them with the active class*/
.navbar.navbar-default .navbar-nav > .open > a,
.navbar.navbar-default .navbar-nav > .open > a:hover,
.navbar.navbar-default .navbar-nav > .open > a:focus {
color: #ffd4d4;
background-color: #ffffff;
}
/*Hamburger Styling*/
.navbar.navbar-default .navbar-toggle {
border-color: #D9D9D9;
}
.navbar.navbar-default .navbar-toggle:hover,
.navbar.navbar-default .navbar-toggle:focus {
background-color: #D9D9D9;
}
.navbar.navbar-default .navbar-toggle .icon-bar {
background-color: #292929;
}
.navbar.navbar-default .navbar-link {
color: #292929;
}
/*HAMBURGER OVER*/
/*changes the color of the links when you hover over them*/
.navbar.navbar-default .navbar-link:hover {
color: #ffd4d4;
}
/*Adjusts the position and aditional styles of the navbar brand (logo)*/
.navbar-brand {
transform: translateX(-50%);
left: 7%;
position: absolute;
padding: 0px;
}
/*Changes the style of the navbar, including the fonts*/
.nav.navbar-nav > li.navbar-center {
font-family: 'Nunito Sans', sans-serif;
font-size: 11px;
}
.navbar-brand > img {
height: 90%;
width: auto;
}
/*Adjust padding and position of the nav*/
#media (min-width:768px) and (max-width:991px){
.container.navbar-container {
width:100%;
padding:0;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title> My Website</title>
<!--Gives access to ig fb pintrest & twitter--><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="style.css" />
<link href="https://fonts.googleapis.com/css?family=Nunito|Nunito+Sans|Playfair+Display" rel="stylesheet">
<!---Bootstrap CSS & JS---->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<header>
<div class="container navbar-container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<!---"Hamburger" drop-down menu--->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-----Logo (right now its the settings wheel)----->
<a class="navbar-brand" href="http://jh.com"><img class= "logo" src="https://cdn2.iconfinder.com/data/icons/social-productivity-line-art-2/128/settings-gear2-512.png"></a>
</div>
<!---The ul and links of the navbar--->
<div id="navbar" class="navbar-collapse collapse">
<!--The html links, navbar-left specifies that they will be on the left side of the bar, and is also used for txt styling-->
<ul class="nav navbar-nav">
<li class="navbar-center">HOME</li>
<li class="navbar-center"> INFORMATION</li>
<li class="navbar-center"> HISTORY </li>
<li class="navbar-center"> ATTRACTIONS </li>
<li class="navbar-center"> GALLERIES </li>
<li class="navbar-center"> CONTACT US </li>
</ul>
<!--similar to above, except this is used for ig fb and twitter logos+links, navbar-right is in the opening <div> since it isn't needed for txt styling anymore-->
<ul class="nav navbar-nav navbar-right">
<li> <i class="fa fa-instagram"></i>
<li> <i class="fa fa-pinterest"></i>
<li> <i class="fa fa-facebook"></i>
<li> <i class="fa fa-twitter"></i>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
</div>
</header>
</body>
</html>
Your provided html is not valid. If you look at .navbar-right, you've not closed any of the list elements.
I'm not sure if your working Bootstrap 4 or Bootstrap 3... Your question is tagged bootstrap-4, but your question code and external libraries seem to be bootstrap-3?
So my solution below is based on the latest Bootstrap 3.4.1.
Inline comments are great... but personally I would not directly write comments in HTML code because anyone who views your source code
can read them! Code comments like yours should only be used in
uncompiled src files (js/css) and server side files (php, etc).
OK, we are using Bootstrap 3 below, so the css methods are kinda old school. There is no flexbox css usage (flexbox css model was first introduced in Bootstrap 4).
Changes I've made to your HTML and CSS...
Added helper CSS to show you which bootstrap breakpoint your viewing in current viewport.
Cleaned up and closed all HTML tags so HTML code is valid.
Changed navbar text to normal titlecase and used css to make uppercase (see css comments).
Removed all unnecessary container divs and css classes.
Added a few custom CSS classes and media queries to achieve your desired output.
Changed Contact us to Contact so you get you seamless breakpoint from SM to XS.
Added a few css tweeks to tighten up navbar/social link padding/font-size when responsively downsizing the viewport.
Here is a jsfiddle version too...
https://jsfiddle.net/joshmoto/6xtjg4mz/
Anyway hope this helps...
/** 'XS' mode navbar ul margins **/
.nav.navbar-nav {
margin: 5px -15px;
}
/** so navbar links text appear normal on google but uppercase on the website **/
.nav.navbar-nav:not(.navbar-social) > li > a {
text-transform: uppercase;
}
/** margins in 'XS' mode and bigger socials icons at 28px **/
.nav.navbar-social {
margin: 10px 0 10px -8px;
overflow: hidden;
font-size: 28px;
}
/** always float left social icons so they dont stack in 'XS' mode **/
.nav.navbar-social > li {
float: left !important;
}
/** same left and right gaps between social icons **/
.nav.navbar-social > li > a {
padding: 15px 8px !important;
}
/** screen size large 'SM' and up **/
#media (min-width: 768px) {
/** 'SM' and up: navbar ul margin force 0 **/
.nav.navbar-nav {
margin: 0 !important;
}
/** 'SM' and up: navbar list links padding **/
.nav.navbar-nav > li > a {
padding: 15px 8px;
}
/** 'SM' and up: social list smaller icons at 20px **/
.nav.navbar-social {
font-size: 20px;
}
}
/** screen size large 'MD' and up **/
#media (min-width: 992px) {
/** 'MD' and up: navbar list links padding (default padding) **/
.nav.navbar-nav > li > a {
padding: 15px 15px;
}
}
/** helper css below **/
/** helper breakpoint indicator screen size large 'XS' and up **/
body::before {
text-transform: lowercase;
position: fixed;
z-index: 10000;
background: red;
font-family: 'Courier New', Courier, monospace;
font-size: 50px;
right: 0;
bottom: 0;
color: white;
padding: 2px 20px;
font-weight: bold;
content: 'XS';
}
/** helper breakpoint indicator screen size large 'SM' and up **/
#media (min-width: 768px) {
body::before {
content: 'SM';
}
}
/** helper breakpoint indicator screen size large 'MD' and up **/
#media (min-width: 992px) {
body::before {
content: 'MD';
}
}
/** helper breakpoint indicator screen size large 'LG' and up **/
#media (min-width: 1200px) {
body::before {
content: 'LG';
}
}
<!-- Fonts & Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito|Nunito+Sans|Playfair+Display" rel="stylesheet">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/jquery#3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<header>
<nav class="navbar navbar-default">
<div class="container">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://jh.com">
<i class="fa fa-cog" aria-hidden="true"></i>
</a>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Information</li>
<li>History</li>
<li>Attractions</li>
<li>Gallery</li>
<li>Contact</li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-social">
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-pinterest"></i></li>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
</ul>
</div>
</div>
</nav>
</header>

How to make nav expand when expanding nav items

I have a portfolio website with a few nav items for different views. I basically copied the default nav code from the bootstrap site. When I expand my "hamburger" the nav remains the same size, hence making the expanded items overlap with the border of my nav. Like this:
I can't seem to find anything on the Bootstrap site to deal with this issue. Does it have to do with my border being there?
Here's my nav code:
.navbar{
height: 10.0rem;
border-bottom: 1px solid rgb(168, 168, 168);
}
.bg-light {
background-color: white !important;
}
.navbar-collapse{
padding-left: 0;
}
#options{
list-style-position: inside;
padding-left: 12rem;
}
#options li{
padding-left: 1rem;
padding-right: 1rem;
font-size: 1.2rem;
font-family: Raleway;
}
li a:hover{
border-bottom: 0.001rem solid black;
}
.navbar-brand{
font-size: 4rem;
padding-left: 3rem;
font-family: Raleway;
font-weight: 400;
}
#header-container {
display: flex;
flex-direction: row-reverse;
justify-content: right;
width: 50%;
height: 50%;
margin: 0 0 0 10%;
padding-left: 30%;
}
html{
height: fit-content;
}
body {
padding-top: 5.0rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alan Alban - Portfolio</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Alan Alban</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<section id="header-container">
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav" id="options">
<li class="nav-item active">
<a class="nav-link" href="/">Experience <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/projects">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/skills">Skills</a>
</li>
</ul>
</div>
</section>
</nav>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</body>
</html>
I appreciate the help in advance
You are only importing the jquery.min.js but you should import the bootatrap.min.js too.
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
This is the full script you should place at the bottom of your body, just before the tag ends.
And move your css in your head tag.
Read the official documentation that will help you getting started, most of the answer are always there.
https://getbootstrap.com/docs/4.5/getting-started/introduction/
You can find there also good working examples that will help you getting started in a proper way.
I figured out what the problem was.
.navbar{
height: 10.0rem;
border-bottom: 1px solid rgb(168, 168, 168);
}
That snippet is how I intended to modify the initial width of my navbar. I removed the height property and it works fine now.
My guess is, by setting a height, I'm essentially anchoring the nav to a specific size. I'm gonna try min height and see if that works. it looks good as it is though since I have padding for my nav elements.

Bootstrap nav bar collapsing

i'm working on upgrading a website so it becomes responsive. I'm using twitter bootstrap. I already tried a couple of different nav bar templates that i found online and i always have the same problem. As you can see in the images in some resolutions the nav bar isn't collapsing the way it should.
The problem:
The navbar html code:
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed">
<div class="container">
<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>
<a class="navbar-brand" href="index.htm">Index</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>casa do meio
</li>
<li>casa brava
</li>
<li>casa velha
</li>
<li>pool
</li>
<li>prijzen
</li>
<li>over ons
</li>
<li>activiteiten
</li>
<li>gastenboek
</li>
<li>kaartje
</li>
<li>contact
</li>
<li>linken
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
I also have this in my css:
#media (min-width: 768px) and (max-width: 991px) {
.navbar-collapse.collapse {
display: none !important;
}
.navbar-collapse.collapse.in {
display: block !important;
}
.navbar-header .collapse, .navbar-toggle {
display:block !important;
}
.navbar-header {
float:none;
}
}
Any help would be appreciated!
This is the complete CSS (*taking into account your site structure) if you want to change your breakpoint for the navigation on smaller viewports.
You should also consider moving some of your links into dropdown lists which would allow you to avoid all of this.
#media (max-width: 1199px) {
#custom-bootstrap-menu .navbar-collapse.collapse {
display: none !important;
}
#custom-bootstrap-menu .navbar-collapse.collapse.in {
display: block !important;
}
#custom-bootstrap-menu .navbar-toggle {
display: block !important;
}
#custom-bootstrap-menu .navbar-collapse {
text-align: center;
display: block !important;
}
#custom-bootstrap-menu .navbar-header {
float: none;
display: block !important;
}
#custom-bootstrap-menu .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
#custom-bootstrap-menu .navbar-nav > li {
float: none;
}
#custom-bootstrap-menu .navbar-nav> li > a {
padding-top: 10px;
padding-bottom: 10px;
}
}
<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" />
<p>
<img src="http://www.huisjeinportugal.nl/images/top.jpg" class="img-responsive">
</p>
<div id="custom-bootstrap-menu" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand" href="index.htm">Index</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><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 class="collapse navbar-collapse navbar-menubuilder">
<ul class="nav navbar-nav">
<li>casa do meio
</li>
<li>casa brava
</li>
<li>casa velha
</li>
<li>pool
</li>
<li>prijzen
</li>
<li>over ons
</li>
<li>activiteiten
</li>
<li>gastenboek
</li>
<li>kaartje
</li>
<li>contact
</li>
<li>linken
</li>
</ul>
</div>
</div>
</div>
It looks like your navigation is fairly wide, so what you could do is simply change when the bootstrap nav collapses. Looking at your code, 1000px seems to be a good breaking point for the collapse to happen, but you can play around with that.
One solution would be to go and add a new media query that will overwite that of Bootstraps. This solution would be fine if you don't want to edit your bootstrap code directly:
#media (max-width: 1000px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
}
Another, easier option, if you are using LESS is to change the variables that trigger the breakpoint. You could instead use something along these lines:
// Point at which the navbar becomes uncollapsed.
#grid-float-breakpoint: 1000px;

Bootstrap ul navigation float right but order left to right

I am trying to code a bootstrap navigation structure with 9 (don't laugh at my client please) buttons.
I want the first 5 buttons on top of the other 4, aligned to the right. The problem is that when I align them to the right, the buttons reverse in order. I solved this by creating two different lists, but that makes it reverse it when making the screen smaller. I think there should be a simple solution, but I can't find it. You can see an example at: http://www.sanderfish.nl/haptokuijpers/index.html
Here is my HTML:
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-left 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="index.html"><img src="assets/img/logo.png"</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>Home</li>
<li>Voor wie</li>
<li>Psychosomatiek</li>
<li>Haptotherapie</li>
<li>Diana Kuijpers</li>
<li>Vergoeding</li>
<li>Klachtenlijsten</li>
<li>Uitgeverij VIB</li>
<li>Contact</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
And this is the CSS:
#media (min-width: 768px) {
.navbar-nav {
float: right;
margin: 0;
text-align: right;
}
.navbar-nav > li {
float: left;
text-align: right;
}
.navbar-nav > li > a {
padding-top: 20px;
padding-bottom: 10px;
display: block;
text-align: right;
}
.navbar-nav.navbar-right:last-child {
margin-right: 0px;
text-align: right;
}
}
#media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
padding-right: 34px;
text-align: right;
max-width: 750px;
}
}
Thanks in advance!
You don't need any custom CSS, just separate the two chunks of links into separate navbar-navs, and do navbar-right on the one you want to the right: DEMO: http://www.bootply.com/X0kDjEwnga
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Voor wie</li>
<li>Psychosomatiek</li>
<li>Haptotherapie</li>
<li>Diana Kuijpers</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Vergoeding</li>
<li>Klachtenlijsten</li>
<li>Uitgeverij VIB</li>
<li>Contact</li>
</ul>
</div><!--/.nav-collapse -->
You may need to address their overlap when at specific in-between widths, but that's another story.
I don't understand why are you doing this since you're overriding not only Bootstrap, but the concept of responsive design altogether, but you'll know. Anyways, simply change this part:
.navbar-inverse .navbar-nav > li > a {
color: #FFF;
float: right;
}
to
.navbar-inverse .navbar-nav > li > a {
color: #FFF;
float: left;
}

Decreasing the height bootstrap navbar size without using less?

I am trying to decrease the height of the Bootstrap 3.1.1's navbar without using the less version of it. I have tried several ways of doing this by reading around on different sites, and none of them are decreasing the CSS's .navbar height.
I have managed to fix the padding on the .navbar-nav > li > a.
My HTML:
<div class="navbar navbar-inverse 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">
<span class="sr-only">Toggle</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">QuadCMS</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Help</li>
</ul>
</div>
</div>
</div>
My CSS which overrides the Bootstrap to try to fix the navbar.
.navbar {
height: 25px !important;
}
.navbar-nav > li > a {
padding-top: 5px !important;
padding-bottom: 5px !important;
}
My main issue is with the actual height of the navbar, not the padding now. The padding of the navigation links are fixed and working at the small size. I have also tried changing the .navbar to .navbar-nav, and .navbar-fixed-top respectfully and nothing has worked yet.
Do I need to call a different CSS Class then the ones I have tried, or do I need to call two of the ones I have already tried to get the effect needed?
Here is the default .navbar styling:
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
You need to overwrite the min-height property. You can use the value inherit.
Example Here
.navbar {
height: 30px;
min-height: inherit;
}
.navbar-nav > li > a {
padding-top: 5px;
padding-bottom: 5px;
}
.navbar-brand {
padding:5px 0 0 0;
}