Search form vertically fills navbar - html

I'm trying to put a search form inline within a navbar like so:
But I end up with a navbar like this:
What I'm trying to do is have the green search bar vertically fill the whole navbar. But when I add more padding, the navbar gets more padding also. How can I do it so that the search bar fills the whole navbar like in the first example?
EDIT
Here is the Bootply with static html: http://www.bootply.com/6UyH4u0NWy#

This might get you headed in the right direction using .form-control to set the height of the input.
/* CSS used here will be applied after bootstrap.css */
/* nav */
.navbar-inverse .navbar-nav li a {
padding-top: 15px;
padding-left: 15px;
}
.navbar.navbar-inverse {
background: white;
border-bottom: solid 1px #979797;
}
.navbar-inverse .nav > li > a {
color: #858585;
font-weight: 500;
font-size: 13.5px;
}
.navbar-inverse .nav > li > a:hover,
.navbar .nav > li > a:focus {
color: black;
-webkit-transition: ease 0.2s;
transition: ease 0.2s;
}
.navbar-inverse .navbar-collapse {
border-top: none;
text-align: center;
#media (max-width: 767px) {
background-color: white;
}
}
.navbar-header h4 {
padding: 5px 0 0 10px;
}
.navbar-nav li .search-box {
height: 100%;
margin-top: none;
background-color: #38A6A6;
border: none;
color: white;
border-radius: 0;
padding-left: 15px;
padding-right: 15px;
padding-bottom: none;
}
.navbar-nav li input.search-query {
height: 100%;
padding-left: 26px;
}
.navbar-nav li form.form-search {
height: 100%;
position: relative;
}
.navbar-nav li form.form-search:before {
height: 100%;
display: block;
width: 14px;
height: 14px;
content: "\e003";
font-family: 'Glyphicons Halflings';
color: white;
background-position: -48px 0;
position: absolute;
top: 16px;
left: 8px;
z-index: 1000;
}
.navbar-nav li .form-control {
height: 50px;
}
<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 navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<h4>Brand</h4>
</div>
<ul class="nav navbar-nav navbar-right">
<li>Link
</li>
<li>Link
</li>
<li>Link
</li>
<li>Link
</li>
<li>
<form class="form-search form-inline">
<input type="text" class="search-box form-control" placeholder="Recipient's username" aria-describedby="basic-addon2" />
</form>
</li>
</ul>
</div>
</nav>

How about setting the height of .form-search to 100% ? The reason it has this current height is because its scale depends on its content (height:auto by default).
Also notice you got syntax errors in your html (closing li tag before closing form tag).

Related

Stubborn White Space at Top of Page

Simple problem but can't seem to find a functional solution. There's a finger-width white space at the top of the page that doesn't have anything highlighted under inspect.
#import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
* {
margin: 0;
padding: 0;
user-select: none;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
.btn {
position: relative;
overflow: hidden;
top: 45px;
left: 45px;
height: 45px;
width: 45px;
text-align: center;
background: #1b1b1b;
border-radius: 3px;
cursor: pointer;
transition: left 0.4s ease;
}
.btn.click {
left: 260px;
}
.btn span {
color: rgb(3, 3, 3);
font-size: 28px;
line-height: 45px;
}
.btn.click span:before {
content: '\f00d';
}
.sidebar {
position: fixed;
width: 225px;
height: 100%;
left: -225px;
background: #1b1b1b;
transition: left 0.4s ease;
}
.sidebar.show {
left: 0px;
}
.sidebar .text {
color: white;
font-size: 25px;
font-weight: 600;
line-height: 65px;
text-align: center;
background: #1e1e1e;
letter-spacing: 1px;
}
nav ul {
background: #1b1b1b;
height: 100%;
width: 100%;
list-style: none;
}
nav ul li {
line-height: 60px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
nav ul li:last-child {
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
nav ul li a {
position: relative;
color: white;
text-decoration: none;
font-size: 18px;
padding-left: 40px;
font-weight: 500;
display: block;
width: 100%;
border-left: 3px solid transparent;
}
nav ul li.active a {
color: cyan;
background: #1e1e1e;
border-left-color: cyan;
}
nav ul li a:hover {
background: #1e1e1e;
}
nav ul ul {
position: static;
display: none;
}
nav ul .feat-show.show {
display: block;
}
nav ul .serv-show.show1 {
display: block;
}
nav ul ul li {
line-height: 42px;
border-top: none;
}
nav ul ul li a {
font-size: 17px;
color: #e6e6e6;
padding-left: 80px;
}
nav ul li.active ul li a {
color: #e6e6e6;
background: #1b1b1b;
border-left-color: transparent;
}
nav ul ul li a:hover {
color: cyan!important;
background: #1e1e1e!important;
}
nav ul li a span {
position: absolute;
top: 50%;
right: 20px;
transform: translateY(-50%);
font-size: 22px;
color: black;
transition: transform 0.4s;
}
nav ul li a span.rotate {
transform: translateY(-50%) rotate(-180deg);
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #202020;
z-index: -1;
text-align: center;
}
.content .header {
font-size: 45px;
font-weight: 600;
}
.content p {
font-size: 30px;
font-weight: 500;
}
html {
height: 100%
}
body {
height: 100%
}
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PeePoo</title>
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</head>
<body>
<div class="btn">
<span class="fas fa-bars"></span>
</div>
<nav class="sidebar">
<div class="text">
Side Menu
</div>
<ul>
<li class="active">Dashboard</li>
<li>
<a href="#" class="feat-btn">Features
<span class="fas fa-caret-down first"></span>
</a>
<ul class="feat-show">
<li>Pages</li>
<li>Elements</li>
</ul>
</li>
<li>
<a href="#" class="serv-btn">Services
<span class="fas fa-caret-down second"></span>
</a>
<ul class="serv-show">
<li>App Design</li>
<li>Web Design</li>
</ul>
</li>
<li>Portfolio</li>
<li>Overview</li>
<li>Shortcuts</li>
<li>Feedback</li>
</ul>
</nav>
<script>
$('.btn').click(function() {
$(this).toggleClass("click");
$('.sidebar').toggleClass("show");
});
$('.feat-btn').click(function() {
$('nav ul .feat-show').toggleClass("show");
$('nav ul .first').toggleClass("rotate");
});
$('.serv-btn').click(function() {
$('nav ul .serv-show').toggleClass("show1");
$('nav ul .second').toggleClass("rotate");
});
$('nav ul li').click(function() {
$(this).addClass("active").siblings().removeClass("active");
});
</script>
</body>
<body>
<h2 class="text-center my-5">The Website of Truth</h2>
<div class="d-flex justify-content-center role=" columnheader ">The Code of Justinian, Book 1 Part 1</div>
<div class="container ">
<div class="justify-content-center "> 1. The Emperors Gratian, Valentinian, and Theodosius to the People of the City of Constantinople.
We desire that all peoples subject to Our benign Empire shall live under the same religion that the Divine Peter, the Apostle, gave to the Romans, and which the said religion declares was introduced by himself, and which it is well known that the Pontiff Damasus, and Peter, Bishop of Alexandria, a man of apostolic sanctity, embraced; that is to say, in accordance with the rules of apostolic discipline and the evangelical doctrine, we should believe that the Father, Son, and Holy Spirit constitute a single Deity, endowed with equal majesty, and united in the Holy Trinity.
(1) We order all those who follow this law to assume the name of Catholic Christians, and considering others as demented and insane, We order that they shall bear the infamy of heresy; and when the Divine vengeance which they merit has been appeased, they shall afterwards be punished in accordance with Our resentment, which we have acquired from the judgment of Heaven.
Dated at Thessalonica, on the third of the Kalends of March, during the Consulate of Gratian, Consul for the fifth time, and Theodosius.
</div>
</div>
</body>
Tried a bunch of things listed on google under the google search "white space at top of page bootstrap" with no luck. Still very new so simple explanations much appreciated <3
This is because your .btn has a top position of 45px therefore the rest of the content align itself to it as it is your first relatively positioned element.
Try adding top: 0; to your .sidebar so that it aligns with the top of the document independently of your button top position and you'll see this space disappear.
Please note that for this fix to work you'll first have to fix a few issues in your markup as mentioned in various comments (only one body tag and ending double quote missing after <div class="d-flex justify-content-center).

Hovering doesn't fill in entire background color of the region/block

When hovering over my li elements the background doesn't highlight the whole desired region, instead, it only highlights a small/narrow portion. How can I get the background color to highlight the entire block of element?
Here is my CSS:
.sidebar-nav {
padding: 5px;
padding-top: 35px;
list-style: none;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #ddd;
margin: 25px 0;
}
.sidebar-nav li a:hover {
background: #16A085;
}
Here is my HTML:
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li><span>Home</span></li>
<li><span>About</span></li>
<li><span>Portfolio</span></li>
<li><span>Misc</span></li>
</ul>
</div>
Your issue is caused by glyphicon icons, to fix it add glyphicon icon classes to <span> tags instead of <a> tags, like this:
.sidebar-nav {
padding: 5px;
padding-top: 35px;
list-style: none;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #ddd;
margin: 25px 0;
}
.sidebar-nav li a:hover {
background: #16A085;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li> Home</span></li>
<li> About</span></li>
<li> Portfolio</span></li>
<li> Misc</span></li>
</ul>
</div>
You have a couple options. Probably simplest would be giving it some padding instead of using line height, which would make it highlight more area.
.sidebar-nav li {
text-indent: 20px;
padding-top: 15px;
padding-bottom: 15px;
}

Vertical Bootstrap Navbar Button Misaligned

I'm working on a responsive navigation bar with Bootstrap for my website. I have it mostly figured out, except for one thing. On devices with screen width < ~775px, such that the buttons are stacked vertically instead of horizontally, the first one extends a bit to the left, misaligning it with the rest of the buttons. What is causing this, and how do I fix it?
JSFiddle: https://jsfiddle.net/w10cspvv/
HTML:
<div id="navbar">
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav nav-pills nav-justified">
<li role="presentation" class="active navbutton">
<img class='squidanim' src='https://www.glowingsquid.com/images/squid.gif' /><span>Home</span>
</li>
<li role='presentation' class='active navbutton'>
<a href='/about.php'><img class='squidanim' src='https://www.glowingsquid.com/images/squid.gif' /><span>About</span></a>
</li>
<li role='presentation' class='active navbutton'>
<a href='/contact.php'><img class='squidanim' src='https://www.glowingsquid.com/images/squid.gif' /><span>Contact</span></a>
</li>
</ul>
</div>
</nav>
</div>
CSS:
body {
background-color: black;
font-size: 16pt;
margin-top: 2em;
}
#navbar {
border: .25em solid #00aeef;
background-color: #00aeef;
border-radius: 25px;
}
.navbar {
margin-bottom: 0em;
}
.navbar-default {
border-radius: 25px;
border-color: #00aeef;
background: #00aeef;
}
.main {
font-family: Ubuntu, Tahoma, Geneva, sans-serif;
margin-left: 6em;
margin-right: 6em;
text-align: center;
}
.nav-pills > li.active > a,
.nav-pills > li.active > a:focus,
.nav-pills > li.active > a:hover {
background-color: #7F00FF;
}
.squidanim {
display: none;
}
.navbutton:hover a > .squidanim {
display: block;
height: 50px;
position: absolute;
z-index: 100;
}
.navbutton {
padding-left: 2em;
padding-right: 2em;
}
.nav > li > a {
padding-top: 0;
padding-bottom: 0;
}
.nav > li > a > span {
padding-top: 10px;
padding-bottom: 10px;
}
#media (max-width: 978px) {
#navbar {
margin-left: 2em;
margin-right: 2em;
}
.main {
margin-left: 1em;
margin-right: 1em;
}
.navbutton {
padding-left: 0;
padding-right: 0;
}
}
I have fixed this in this JSFiddle: https://jsfiddle.net/xpn779Lr/1/
Which overrides the default bootstrap rule
.nav-pills>li+li {
margin-left: 2px;
}
to
.nav-pills>li+li {
margin-left: 0;
}
FYI, this css rule has high specificity.
The plus sign mean that the style applies only to li's directly following another li.
A plain "li" selector would apply the style to every li in the div with a "navpills" class.
See adjacent selectors on W3.org.

bootstrap collapse menu has 2 rows

I am building this website
torgoborudovanie.com
I have a collapsing navbar build with bootstrap.But when I try to resize the window I get something like this :
As you can see (and you can actually try it ) nav bar now has 2 lines and it looks wired (the actual problem is that it looks like this on Iphone and Ipad) Then you can resize it a little bit more and it gets collapsed as I want.
You can see the code by simply viewing html code in developer tools.
So I will not post it here to make qustion clean and small.But if you want I can post the code here too=)
I ended up with this (quite shitty to be fair workaround)
On page load if I have window.width less than 1200px I just hide long text.
function hideSlogan() {
if($(window).width() <1200) {$('.slogan').hide()}
};
hideSlogan();
Go to the CSS rules starting at the MOBILE NAV comment; these are the rules you can adjust to make the navbar collapse at different breakpoints.
On a sidenote, there is one extra, broken list tag in the nav and with the positioning of Надежный партнер - качественные решения! inside your navbar-collapse div you'll the following behavior:
If you expand the menu when it's in the mobile and then expand the viewport your navbar will revert to the line-height: 60px unless the browser is refreshed. Might not matter but since you're trying to change the collapse breakpoint it's worth mentioning.
**I also moved the inline styles with the rest of the CSS Rules.
#import url(http://fonts.googleapis.com/css?family=Open+Sans:400, 700, 800);
#import url(http://fonts.googleapis.com/css?family=Libre+Baskerville:400italic);
* {
margin: 0;
padding: 0px;
font-family: 'Open Sans', sans-serif;
}
body {
background: #fff;
margin: 0;
color: #42413e;
padding-top: 50px;
}
/* BOOTSTRAP MODIFICATION */
.navbar-right a .btn-orange {
margin-top: -5px;
}
.btn-orange {
background: #f27242;
border-radius: 2px;
color: white;
font-size: 12px;
font-weight: 700;
}
.btn-orange:hover {
background: #e16a3e;
color: white;
}
.navbar-default .navbar-brand {
height: 50px;
padding: 10px 15px;
font-size: 20px;
line-height: 22px;
font-weight: 700;
}
.navbar.navbar-default {
background-color: #ffffff;
border-color: #e7e7e7;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #f27242;
background-color: transparent;
}
.navbar-default .navbar-nav > li > a {
color: #ccc;
}
.navbar-default .navbar-right {
padding-top: 5px
}
.navbar-default li.dropdown a {
color: black;
}
.navbar-default span.head-title {
line-height: 60px;
}
.navbar-default .navbar-right .dropdown-menu {
right: auto;
left: 0;
}
.navbar-right li.contact-info a {
color: #42413e;
}
/****MOBILE NAVBAR******/
#media (max-width: 1200px) {
.custom-navbar .navbar-header {
float: none;
}
.custom-navbar .navbar-left,
.custom-navbar .navbar-right {
float: none !important;
}
.custom-navbar .navbar-toggle {
display: block;
}
.custom-navbar .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
overflow-x: hidden;
}
.custom-navbar.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.custom-navbar .navbar-collapse.collapse {
display: none!important;
}
.custom-navbar .navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.custom-navbar .navbar-nav > li {
float: none;
}
.custom-navbar .navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
}
.custom-navbar .collapse.in {
display: block !important;
}
.custom-navbar .navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.custom-navbar .navbar-brand {
height: 55px;
padding: 10px 15px;
font-size: 20px;
line-height: 22px;
font-weight: 700;
}
}
<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" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
<nav class="navbar navbar-default custom-navbar 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">Переключить навигацию</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://www.torgoborudovanie.com/assets/img/logo1.png" width="140">
</a>
</div>
<div class="collapse navbar-collapse"><span class="head-title">Надежный партнер - качественные решения!</span>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"> Каталог <span class="caret"></span>
<ul class="dropdown-menu">
<li>Стеллажи
</li>
<li>Торговая мебель
</li>
<li>Тележки и корзины
</li>
<li> Кассовые боксы
</li>
<li>Холодильное оборудование
</li>
<li role="separator" class="divider"></li>
<li>Условия доставки
</li>
</ul>
</li>
<li class="contact-info">
<i class="fa fa-phone "></i> 8 (343) 3448090
</li>
<li class="contact-info">
<i class="fa fa-envelope"></i> info#optimagp.ru
</li>
<li>
<a href="#f">
<button class="btn btn-sm btn-orange" type="button">Заказать звонок</button>
</a>
</li>
</ul>
</div>
</div>
</nav>
you need to change your breakpoint, when the navbar gets collapsed...
so for example, this should work:
#media only screen and (min-width: 1200px) {
.collapse {
display: block;
}
.navbar-toggle {
display: none;
}
}
#media only screen and (max-width: 1200px) {
.collapse {
display: none;
}
.navbar-toggle {
display: block;
}
}
because it floats (because its so long) after 1200px width...
** sorry, i made a mistake... try it now :) **

Fixing ul to right of bootstrap navbar

Disclaimer: Pardon my stupidity when it comes to coding. I started learning last week.
I have been tinkering around with a Bootstrap 3 template from a Youtube tutorial I found to assist me in learning HTML, CSS, and eventually Java. In this example I'm working on, I am trying to get the inline unordered list to float to the right of the page. I tried adding float:right to most of the navbar elements in the CSS, but it's not doing anything for me. Any help would be greatly appreciated.
HTML:
<div class="navbar navbar-fixed-top">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img src="images/logo.png" alt="Your Logo"></a>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li class="active">
Home
</li>
<li class="inactive">
Photos
</li>
<li class="inactive">
Videos
</li>
<li class="inactive">
Contact Us
</li>
</ul>
</div><!-- end nav-collapse -->
</div><!-- end container -->
</div><!-- end navbar -->
CSS:
.navbar {
position: relative;
min-height: 50px;
padding-right: 15px;
padding-left: 15px;
margin-bottom: 20px;
background-color: #eeeeee;
border-radius: 4px;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar-nav {
margin-top: 10px;
margin-bottom: 15px;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
line-height: 20px;
color: #777777;
border-radius: 4px;
}
.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus {
color: #333333;
background-color: transparent;
}
.navbar-nav > .active > a,
.navbar-nav > .active > a:hover,
.navbar-nav > .active > a:focus {
color: #555555;
background-color: #d5d5d5;
}
.navbar-nav > .disabled > a,
.navbar-nav > .disabled > a:hover,
.navbar-nav > .disabled > a:focus {
color: #cccccc;
background-color: transparent;
}
.navbar-nav.pull-right {
width: 100%;
}
.navbar-static-top {
border-radius: 0;
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
border-radius: 0;
}
.navbar-fixed-top {
top: 0;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
}
.navbar-brand {
display: block;
max-width: 200px;
padding: 15px 15px;
margin-right: auto;
margin-left: auto;
font-size: 18px;
font-weight: 500;
line-height: 20px;
color: #777777;
text-align: center;
}
.navbar-brand:hover,
.navbar-brand:focus {
color: #5e5e5e;
text-decoration: none;
background-color: transparent;
}
.navbar-toggle {
position: absolute;
top: 9px;
right: 10px;
width: 48px;
height: 32px;
padding: 8px 12px;
background-color: transparent;
border: 1px solid #dddddd;
border-radius: 4px;
}
.navbar-toggle:hover,
.navbar-toggle:focus {
background-color: #dddddd;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
background-color: #cccccc;
border-radius: 1px;
}
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px;
}
As you are using Bootstrap, to so you may use class .pull-right to align it to right.
For more info click here.
In Bootstrap v 3.** it is better practice to use "navbar-right" so the proper context should read:
ul class = "nav navbar-nav navbar-right"
If you are using bootstrap 3 the use navbar-right to pull right h
jsfiddle.net/makk/9yxeg7r5/2 - this is a similar example
<div id="top"></div>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="row">
<div class="navbar-header">
<a class="navbar-brand" href="#top"><span class="fa fa-book fa-3x">MATH</span></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li>Home</li>
<li>Features</li>
<li>Courses</li>
<li>Pricing</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>