Bootstrap 4 align navbar items to the rightBootstrap 4 navbar items on right sideBootstrap 4 — Moving links to the right of the navbar with a toggle buttonBootstrap 4 float-right not working with the navbarBootstrap 4 - Right Align Navbar ItemsBootstrap 4 align two navbar menu buttons to right sideBootstrap 4, allign navbar items rightBootstrap Navbar with Logo on Left and Items on RightBootstrap float navbar items to the rightHow to shift Bootstrap 4 navbar li elements to right?How do you position navbar items to the right in Bootstrap 4?How to align checkboxes and their labels consistently cross-browsersVertically align text next to an image?Make the cursor a hand when a user hovers over a list itemCenter a column using Twitter Bootstrap 3Bootstrap 3 Navbar with LogoChange navbar color in Twitter BootstrapBootstrap NavBar with left, center or right aligned itemsvertical-align with Bootstrap 3How to Right-align flex item?
We are on WHV, my boyfriend was in a small collision, we are leaving in 2 weeks what happens if we don’t pay the damages?
Does "as soon as" imply simultaneity?
What secular civic space would pioneers build for small frontier towns?
A famous scholar sent me an unpublished draft of hers. Then she died. I think her work should be published. What should I do?
Youtube not blocked by iptables
Is a Middle Name a Given Name?
What is the white pattern on trim wheel for?
Why is 6. Nge2 better, and 7. d5 a necessary push in this game?
New road bike: alloy dual pivot brakes work poorly
Difference between types of yeast
Suffocation while cooking under an umbrella?
Need Improvement on Script Which Continuosly Tests Website
What would influence an alien race to map their planet in a way other than the traditional map of the Earth
Reorder a matrix, twice
Why is a road bike faster than a city bike with the same effort? How much faster it can be?
Received a package but didn't order it
How to deal with a Homophobic PC
I am not a pleasant sight
What happens to a net with the Returning Weapon artificer infusion after it hits?
What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?
Is it impolite to ask for an in-flight catalogue with no intention of buying?
Why was it decided in 1956 to abolish the spelling чорт (devil) in favor of чёрт?
Am I storing my camera the wrong way, in a dry box with humidity between 37-48?
Why does the leading tone (G#) go to E rather than A in this example?
Bootstrap 4 align navbar items to the right
Bootstrap 4 navbar items on right sideBootstrap 4 — Moving links to the right of the navbar with a toggle buttonBootstrap 4 float-right not working with the navbarBootstrap 4 - Right Align Navbar ItemsBootstrap 4 align two navbar menu buttons to right sideBootstrap 4, allign navbar items rightBootstrap Navbar with Logo on Left and Items on RightBootstrap float navbar items to the rightHow to shift Bootstrap 4 navbar li elements to right?How do you position navbar items to the right in Bootstrap 4?How to align checkboxes and their labels consistently cross-browsersVertically align text next to an image?Make the cursor a hand when a user hovers over a list itemCenter a column using Twitter Bootstrap 3Bootstrap 3 Navbar with LogoChange navbar color in Twitter BootstrapBootstrap NavBar with left, center or right aligned itemsvertical-align with Bootstrap 3How to Right-align flex item?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How do I align a navbar item to right?
I want to have the login and register to the right.
But everything I try does not seem to work.

This is what I have tried so far:
<div>around the<ul>with the atribute:style="float: right"<div>around the<ul>with the atribute:style="text-align: right"- tried those two things on the
<li>tags - tried all those things again with
!importantadded to the end - changed
nav-itemtonav-rightin the<li> - added a
pull-sm-rightclass to the<li> - added a
align-content-endclass to the<li>
This is my code:
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
css twitter-bootstrap flexbox bootstrap-4 navbar
add a comment
|
How do I align a navbar item to right?
I want to have the login and register to the right.
But everything I try does not seem to work.

This is what I have tried so far:
<div>around the<ul>with the atribute:style="float: right"<div>around the<ul>with the atribute:style="text-align: right"- tried those two things on the
<li>tags - tried all those things again with
!importantadded to the end - changed
nav-itemtonav-rightin the<li> - added a
pull-sm-rightclass to the<li> - added a
align-content-endclass to the<li>
This is my code:
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
css twitter-bootstrap flexbox bootstrap-4 navbar
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12
add a comment
|
How do I align a navbar item to right?
I want to have the login and register to the right.
But everything I try does not seem to work.

This is what I have tried so far:
<div>around the<ul>with the atribute:style="float: right"<div>around the<ul>with the atribute:style="text-align: right"- tried those two things on the
<li>tags - tried all those things again with
!importantadded to the end - changed
nav-itemtonav-rightin the<li> - added a
pull-sm-rightclass to the<li> - added a
align-content-endclass to the<li>
This is my code:
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
css twitter-bootstrap flexbox bootstrap-4 navbar
How do I align a navbar item to right?
I want to have the login and register to the right.
But everything I try does not seem to work.

This is what I have tried so far:
<div>around the<ul>with the atribute:style="float: right"<div>around the<ul>with the atribute:style="text-align: right"- tried those two things on the
<li>tags - tried all those things again with
!importantadded to the end - changed
nav-itemtonav-rightin the<li> - added a
pull-sm-rightclass to the<li> - added a
align-content-endclass to the<li>
This is my code:
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
css twitter-bootstrap flexbox bootstrap-4 navbar
css twitter-bootstrap flexbox bootstrap-4 navbar
edited Dec 20 '18 at 21:53
Zim
220k54 gold badges467 silver badges434 bronze badges
220k54 gold badges467 silver badges434 bronze badges
asked Jan 6 '17 at 20:02
Luuk WuijsterLuuk Wuijster
2,0112 gold badges13 silver badges40 bronze badges
2,0112 gold badges13 silver badges40 bronze badges
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12
add a comment
|
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12
add a comment
|
18 Answers
18
active
oldest
votes
Bootstrap 4 has many different ways to align navbar items. float-right won't work because the navbar is now flexbox.
You can use the new mr-auto for auto right margin on the 1st (left) navbar-nav.
Alternatively, ml-auto could be used on the 2nd (right) navbar-nav , or if you just have a single navbar-nav.
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
http://www.codeply.com/go/P0G393rzfm
There are also flexbox utils. In this case, you have 2 navbar-navs, so justify-content-between in navbar-collapse would work the even the space between them,
<div class="navbar-collapse collapse justify-content-between">
<ul class="navbar-nav mr-auto">
..
</ul>
<ul class="navbar-nav">
..
</ul>
</div>
Update for Bootstrap 4.0 and newer
As of Bootstrap 4 beta, ml-auto will still work to push items to the right. Just be aware the the navbar-toggleable- classes have changed to navbar-expand-*
Updated navbar right for Bootstrap 4
Another frequent Bootstrap 4 Navbar right alignment scenario includes a button on the right that remains outside the mobile collapse nav so that it is always shown at all widths.
Right align button that is always visible


Related: Bootstrap NavBar with left, center or right aligned items
mr-autodoesn't work if the right-most item is adropdown. The dropdown items spill over the right edge of the page.
– Ege Ersoz
May 16 '17 at 17:13
4
It works: codeply.com/go/P0G393rzfm - the issue is notmr-autoas the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…
– Zim
May 16 '17 at 17:20
You can also add.dropdown-menu-rightto right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.
– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
|
show 3 more comments
In my case, I wanted just one set of navigation buttons / options and found that this will work:
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Sign Out</a>
</li>
</ul>
</div>
So, you will add justify-content-end to the div and omit mr-auto on the list.
Here is a working example.
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but themr-automethod is used in the Bootstrap docs.
– Zim
Feb 3 '17 at 12:32
mr-autois used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6
– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
|
show 1 more comment
For those who is still struggling with this issue in BS4 simply try below code -
<ul class="navbar-nav ml-auto">
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc aboutm*-autoit pushes content to the left or right depending on where you put the class
– Pierre de LESPINAY
Jan 22 at 16:05
add a comment
|
On Bootstrap 4
If you want to align brand to your left and all the navbar-items to right, change the default mr-auto to ml-auto
<ul class="navbar-nav ml-auto">
add a comment
|
On Bootsrap 4.0.0-beta.2, none of the answers listed here worked for me. Finally, the Bootstrap site gave me the solution, not via its doc but via its page source code...
Getbootstrap.com align their right navbar-nav to the right with the help of the following class: ml-md-auto.
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
add a comment
|
Use ml-auto instead of mr-auto after applying nav justify-content-end to the ul
add a comment
|
If you want Home, Features and Pricing on left immediately after your nav-brand, and then login and register on right then wrap the two lists in <div> and use .justify-content-between:
<div class="collapse navbar-collapse justify-content-between">
<ul>....</ul>
<ul>...</ul>
</div>
add a comment
|
Just add mr-auto class at ul
<ul class="nav navbar-nav mr-auto">
If you have menu list in both side you can do something like this:
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">left 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">left 2</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">left disable</a>
</li>
</ul>
add a comment
|
use the flex-row-reverse class
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<i class="fa fa-hospital-o fa-2x" aria-hidden="true"></i>
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li><a class="nav-item nav-link active" href="#" style="background-color:#666">Home <span class="sr-only">(current)</span></a</li>
<li><a class="nav-item nav-link" href="#">Doctors</a></li>
<li><a class="nav-item nav-link" href="#">Specialists</a></li>
<li><a class="nav-item nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
add a comment
|
Use this code for move items to right.
div class="collapse navbar-collapse justify-content-end"
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
add a comment
|
I am running Angular 4 (v.4.0.0) and ng-bootstrap (Bootstrap 4). This code won't all be relevant but hoping people can pick and choose what works. It took me sometime to find a solution to get my items to justify right, collapse properly and to implement a dropdown off my google (using OAuth) profile picture.
<div id="header" class="header">
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<img alt='Brand' src='../assets/images/logo-white.png' class='navbar-logo-img d-inline-block align-top '>
<span class="navbar-logo-text">Oncoscape</span>
</a>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav float-left">
<a class="navbar-items nav-item nav-link active " *ngIf='authenticated' (click)='goDashboard()'>
<span class="fa fa-dashboard"></span>Dashboard
</a>
<a class="nav-item nav-link navbar-items active" href="http://resources.sttrcancer.org/oncoscape-contact">
<span class="fa fa-comments"></span>Feedback
</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img *ngIf='user && authenticated' class="navbar-pic" src=user.thumbnail alt="Smiley face">
</a>
<div *ngIf='user && authenticated' class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" (click)="toProfile()">Account</a>
<div class="dropdown-item">
<app-login></app-login>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
<router-outlet></router-outlet>
add a comment
|
For Bootstrap 4 beta, sample navbar with elements aligned to the right side is:
<div id="app" class="container">
<nav class="navbar navbar-expand-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
add a comment
|
Using the bootstrap flex box helps
us to control the placement and alignment of your navigation element.
for the problem above adding mr-auto is a better solution to it .
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
other placement may include
fixed- top
fixed bottom
sticky-top
add a comment
|
The working example for BS v4.0.0-beta.2:
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
container content
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
add a comment
|
If all above fails, I added 100% width to the navbar class in CSS. Until then mr auto wasn't working for me on this project using 4.1.
add a comment
|
Find the 69 line in the verndor-prefixes.less and write it following:
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
add a comment
|
Just copied this from one of the getbootstrap pages for the released version 4 which worked much better than the above
<div class="d-none d-xl-block col-xl-2 bd-toc float-md-right">
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#overview">Overview</a></li>
<li class="toc-entry toc-h2"><a href="#classes">Classes</a></li>
<li class="toc-entry toc-h2"><a href="#mixins">Mixins</a></li>
<li class="toc-entry toc-h2"><a href="#responsive">Responsive</a></li>
</ul>
</div>
add a comment
|
I'm new to stack overflow and new to front end development. This is what worked for me. So I did not want list items to be displayed.
.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>add a comment
|
protected by Zim Mar 6 '18 at 13:46
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
18 Answers
18
active
oldest
votes
18 Answers
18
active
oldest
votes
active
oldest
votes
active
oldest
votes
Bootstrap 4 has many different ways to align navbar items. float-right won't work because the navbar is now flexbox.
You can use the new mr-auto for auto right margin on the 1st (left) navbar-nav.
Alternatively, ml-auto could be used on the 2nd (right) navbar-nav , or if you just have a single navbar-nav.
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
http://www.codeply.com/go/P0G393rzfm
There are also flexbox utils. In this case, you have 2 navbar-navs, so justify-content-between in navbar-collapse would work the even the space between them,
<div class="navbar-collapse collapse justify-content-between">
<ul class="navbar-nav mr-auto">
..
</ul>
<ul class="navbar-nav">
..
</ul>
</div>
Update for Bootstrap 4.0 and newer
As of Bootstrap 4 beta, ml-auto will still work to push items to the right. Just be aware the the navbar-toggleable- classes have changed to navbar-expand-*
Updated navbar right for Bootstrap 4
Another frequent Bootstrap 4 Navbar right alignment scenario includes a button on the right that remains outside the mobile collapse nav so that it is always shown at all widths.
Right align button that is always visible


Related: Bootstrap NavBar with left, center or right aligned items
mr-autodoesn't work if the right-most item is adropdown. The dropdown items spill over the right edge of the page.
– Ege Ersoz
May 16 '17 at 17:13
4
It works: codeply.com/go/P0G393rzfm - the issue is notmr-autoas the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…
– Zim
May 16 '17 at 17:20
You can also add.dropdown-menu-rightto right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.
– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
|
show 3 more comments
Bootstrap 4 has many different ways to align navbar items. float-right won't work because the navbar is now flexbox.
You can use the new mr-auto for auto right margin on the 1st (left) navbar-nav.
Alternatively, ml-auto could be used on the 2nd (right) navbar-nav , or if you just have a single navbar-nav.
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
http://www.codeply.com/go/P0G393rzfm
There are also flexbox utils. In this case, you have 2 navbar-navs, so justify-content-between in navbar-collapse would work the even the space between them,
<div class="navbar-collapse collapse justify-content-between">
<ul class="navbar-nav mr-auto">
..
</ul>
<ul class="navbar-nav">
..
</ul>
</div>
Update for Bootstrap 4.0 and newer
As of Bootstrap 4 beta, ml-auto will still work to push items to the right. Just be aware the the navbar-toggleable- classes have changed to navbar-expand-*
Updated navbar right for Bootstrap 4
Another frequent Bootstrap 4 Navbar right alignment scenario includes a button on the right that remains outside the mobile collapse nav so that it is always shown at all widths.
Right align button that is always visible


Related: Bootstrap NavBar with left, center or right aligned items
mr-autodoesn't work if the right-most item is adropdown. The dropdown items spill over the right edge of the page.
– Ege Ersoz
May 16 '17 at 17:13
4
It works: codeply.com/go/P0G393rzfm - the issue is notmr-autoas the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…
– Zim
May 16 '17 at 17:20
You can also add.dropdown-menu-rightto right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.
– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
|
show 3 more comments
Bootstrap 4 has many different ways to align navbar items. float-right won't work because the navbar is now flexbox.
You can use the new mr-auto for auto right margin on the 1st (left) navbar-nav.
Alternatively, ml-auto could be used on the 2nd (right) navbar-nav , or if you just have a single navbar-nav.
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
http://www.codeply.com/go/P0G393rzfm
There are also flexbox utils. In this case, you have 2 navbar-navs, so justify-content-between in navbar-collapse would work the even the space between them,
<div class="navbar-collapse collapse justify-content-between">
<ul class="navbar-nav mr-auto">
..
</ul>
<ul class="navbar-nav">
..
</ul>
</div>
Update for Bootstrap 4.0 and newer
As of Bootstrap 4 beta, ml-auto will still work to push items to the right. Just be aware the the navbar-toggleable- classes have changed to navbar-expand-*
Updated navbar right for Bootstrap 4
Another frequent Bootstrap 4 Navbar right alignment scenario includes a button on the right that remains outside the mobile collapse nav so that it is always shown at all widths.
Right align button that is always visible


Related: Bootstrap NavBar with left, center or right aligned items
Bootstrap 4 has many different ways to align navbar items. float-right won't work because the navbar is now flexbox.
You can use the new mr-auto for auto right margin on the 1st (left) navbar-nav.
Alternatively, ml-auto could be used on the 2nd (right) navbar-nav , or if you just have a single navbar-nav.
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
http://www.codeply.com/go/P0G393rzfm
There are also flexbox utils. In this case, you have 2 navbar-navs, so justify-content-between in navbar-collapse would work the even the space between them,
<div class="navbar-collapse collapse justify-content-between">
<ul class="navbar-nav mr-auto">
..
</ul>
<ul class="navbar-nav">
..
</ul>
</div>
Update for Bootstrap 4.0 and newer
As of Bootstrap 4 beta, ml-auto will still work to push items to the right. Just be aware the the navbar-toggleable- classes have changed to navbar-expand-*
Updated navbar right for Bootstrap 4
Another frequent Bootstrap 4 Navbar right alignment scenario includes a button on the right that remains outside the mobile collapse nav so that it is always shown at all widths.
Right align button that is always visible


Related: Bootstrap NavBar with left, center or right aligned items
edited Aug 15 '18 at 13:04
answered Jan 6 '17 at 20:25
ZimZim
220k54 gold badges467 silver badges434 bronze badges
220k54 gold badges467 silver badges434 bronze badges
mr-autodoesn't work if the right-most item is adropdown. The dropdown items spill over the right edge of the page.
– Ege Ersoz
May 16 '17 at 17:13
4
It works: codeply.com/go/P0G393rzfm - the issue is notmr-autoas the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…
– Zim
May 16 '17 at 17:20
You can also add.dropdown-menu-rightto right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.
– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
|
show 3 more comments
mr-autodoesn't work if the right-most item is adropdown. The dropdown items spill over the right edge of the page.
– Ege Ersoz
May 16 '17 at 17:13
4
It works: codeply.com/go/P0G393rzfm - the issue is notmr-autoas the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…
– Zim
May 16 '17 at 17:20
You can also add.dropdown-menu-rightto right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.
– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
mr-auto doesn't work if the right-most item is a dropdown. The dropdown items spill over the right edge of the page.– Ege Ersoz
May 16 '17 at 17:13
mr-auto doesn't work if the right-most item is a dropdown. The dropdown items spill over the right edge of the page.– Ege Ersoz
May 16 '17 at 17:13
4
4
It works: codeply.com/go/P0G393rzfm - the issue is not
mr-auto as the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…– Zim
May 16 '17 at 17:20
It works: codeply.com/go/P0G393rzfm - the issue is not
mr-auto as the question is about aligning right which works. Post a new question if you have concerns with the dropdown, but you're most likely referring to this issue: stackoverflow.com/questions/43867258/…– Zim
May 16 '17 at 17:20
You can also add
.dropdown-menu-right to right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.– rybo111
Jan 27 '18 at 22:36
You can also add
.dropdown-menu-right to right-aligned dropdowns in the navbar. Not doing so can cut off the dropdown at certain widths.– rybo111
Jan 27 '18 at 22:36
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
@ZimSystem thank you for your answers. I have been following your answer over here stackoverflow.com/questions/19733447/… . I have a question how can I achieve one item to be on the left side and one item on the right side ?
– Lokesh
Apr 6 '18 at 14:32
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
In codeply.com/go/P0G393rzfm, you've shown one ul on the left and one ul on the right. That was achieved by adding mr-auto to the first one. But what if I have only one ul? I don't want to create an empty ul just for aligning another one to the right.
– Santosh Kumar
May 26 at 3:01
|
show 3 more comments
In my case, I wanted just one set of navigation buttons / options and found that this will work:
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Sign Out</a>
</li>
</ul>
</div>
So, you will add justify-content-end to the div and omit mr-auto on the list.
Here is a working example.
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but themr-automethod is used in the Bootstrap docs.
– Zim
Feb 3 '17 at 12:32
mr-autois used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6
– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
|
show 1 more comment
In my case, I wanted just one set of navigation buttons / options and found that this will work:
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Sign Out</a>
</li>
</ul>
</div>
So, you will add justify-content-end to the div and omit mr-auto on the list.
Here is a working example.
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but themr-automethod is used in the Bootstrap docs.
– Zim
Feb 3 '17 at 12:32
mr-autois used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6
– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
|
show 1 more comment
In my case, I wanted just one set of navigation buttons / options and found that this will work:
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Sign Out</a>
</li>
</ul>
</div>
So, you will add justify-content-end to the div and omit mr-auto on the list.
Here is a working example.
In my case, I wanted just one set of navigation buttons / options and found that this will work:
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Sign Out</a>
</li>
</ul>
</div>
So, you will add justify-content-end to the div and omit mr-auto on the list.
Here is a working example.
answered Jan 8 '17 at 1:49
Craig van TonderCraig van Tonder
3,95413 gold badges51 silver badges89 bronze badges
3,95413 gold badges51 silver badges89 bronze badges
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but themr-automethod is used in the Bootstrap docs.
– Zim
Feb 3 '17 at 12:32
mr-autois used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6
– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
|
show 1 more comment
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but themr-automethod is used in the Bootstrap docs.
– Zim
Feb 3 '17 at 12:32
mr-autois used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6
– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
3
3
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
@numediaweb In the OPs example, he uses two elements within the nav, aligning one left and one right; where I used only one and aligned it to the right. It's not the right answer but it's helpful as an answer to a slight variation of the question ;)
– Craig van Tonder
Jan 25 '17 at 6:34
This works for a single navbar-nav, but the
mr-auto method is used in the Bootstrap docs.– Zim
Feb 3 '17 at 12:32
This works for a single navbar-nav, but the
mr-auto method is used in the Bootstrap docs.– Zim
Feb 3 '17 at 12:32
mr-auto is used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6– qwaz
Apr 27 '17 at 15:48
mr-auto is used in docs, but not to align items to the left. This answer is semantically correct as mentioned in this article: blog.getbootstrap.com/2017/01/06/bootstrap-4-alpha-6– qwaz
Apr 27 '17 at 15:48
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
The question is are you trying to align 2 list of links or 1. If just 1, your answer works and was very helpful to me. Thanks!
– barefootsanders
Sep 15 '17 at 21:22
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
It worked for me, but I don't know why the one above this answer doesn't work.
– Suhail Akhtar
Dec 24 '18 at 19:10
|
show 1 more comment
For those who is still struggling with this issue in BS4 simply try below code -
<ul class="navbar-nav ml-auto">
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc aboutm*-autoit pushes content to the left or right depending on where you put the class
– Pierre de LESPINAY
Jan 22 at 16:05
add a comment
|
For those who is still struggling with this issue in BS4 simply try below code -
<ul class="navbar-nav ml-auto">
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc aboutm*-autoit pushes content to the left or right depending on where you put the class
– Pierre de LESPINAY
Jan 22 at 16:05
add a comment
|
For those who is still struggling with this issue in BS4 simply try below code -
<ul class="navbar-nav ml-auto">
For those who is still struggling with this issue in BS4 simply try below code -
<ul class="navbar-nav ml-auto">
answered Jan 20 '18 at 11:29
Muhammad TariqueMuhammad Tarique
5956 silver badges14 bronze badges
5956 silver badges14 bronze badges
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc aboutm*-autoit pushes content to the left or right depending on where you put the class
– Pierre de LESPINAY
Jan 22 at 16:05
add a comment
|
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc aboutm*-autoit pushes content to the left or right depending on where you put the class
– Pierre de LESPINAY
Jan 22 at 16:05
6
6
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
No - that aligns everything to the right. The question says he only wants to align a single item to the right.
– NickG
Feb 8 '18 at 17:11
Check the official doc about
m*-auto it pushes content to the left or right depending on where you put the class– Pierre de LESPINAY
Jan 22 at 16:05
Check the official doc about
m*-auto it pushes content to the left or right depending on where you put the class– Pierre de LESPINAY
Jan 22 at 16:05
add a comment
|
On Bootstrap 4
If you want to align brand to your left and all the navbar-items to right, change the default mr-auto to ml-auto
<ul class="navbar-nav ml-auto">
add a comment
|
On Bootstrap 4
If you want to align brand to your left and all the navbar-items to right, change the default mr-auto to ml-auto
<ul class="navbar-nav ml-auto">
add a comment
|
On Bootstrap 4
If you want to align brand to your left and all the navbar-items to right, change the default mr-auto to ml-auto
<ul class="navbar-nav ml-auto">
On Bootstrap 4
If you want to align brand to your left and all the navbar-items to right, change the default mr-auto to ml-auto
<ul class="navbar-nav ml-auto">
answered Apr 3 '18 at 2:15
geet Sebastiangeet Sebastian
3803 silver badges9 bronze badges
3803 silver badges9 bronze badges
add a comment
|
add a comment
|
On Bootsrap 4.0.0-beta.2, none of the answers listed here worked for me. Finally, the Bootstrap site gave me the solution, not via its doc but via its page source code...
Getbootstrap.com align their right navbar-nav to the right with the help of the following class: ml-md-auto.
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
add a comment
|
On Bootsrap 4.0.0-beta.2, none of the answers listed here worked for me. Finally, the Bootstrap site gave me the solution, not via its doc but via its page source code...
Getbootstrap.com align their right navbar-nav to the right with the help of the following class: ml-md-auto.
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
add a comment
|
On Bootsrap 4.0.0-beta.2, none of the answers listed here worked for me. Finally, the Bootstrap site gave me the solution, not via its doc but via its page source code...
Getbootstrap.com align their right navbar-nav to the right with the help of the following class: ml-md-auto.
On Bootsrap 4.0.0-beta.2, none of the answers listed here worked for me. Finally, the Bootstrap site gave me the solution, not via its doc but via its page source code...
Getbootstrap.com align their right navbar-nav to the right with the help of the following class: ml-md-auto.
edited Dec 11 '17 at 23:39
Mogsdad
34.8k12 gold badges103 silver badges215 bronze badges
34.8k12 gold badges103 silver badges215 bronze badges
answered Dec 11 '17 at 23:16
ClemCClemC
4675 silver badges13 bronze badges
4675 silver badges13 bronze badges
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
add a comment
|
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
Worked beautifully for me. Nothing else did.
– Maria Campbell
Sep 14 '18 at 5:05
add a comment
|
Use ml-auto instead of mr-auto after applying nav justify-content-end to the ul
add a comment
|
Use ml-auto instead of mr-auto after applying nav justify-content-end to the ul
add a comment
|
Use ml-auto instead of mr-auto after applying nav justify-content-end to the ul
Use ml-auto instead of mr-auto after applying nav justify-content-end to the ul
edited Nov 13 '17 at 17:50
Gerry
8,6992 gold badges21 silver badges33 bronze badges
8,6992 gold badges21 silver badges33 bronze badges
answered Oct 29 '17 at 3:22
James PikeJames Pike
1412 silver badges9 bronze badges
1412 silver badges9 bronze badges
add a comment
|
add a comment
|
If you want Home, Features and Pricing on left immediately after your nav-brand, and then login and register on right then wrap the two lists in <div> and use .justify-content-between:
<div class="collapse navbar-collapse justify-content-between">
<ul>....</ul>
<ul>...</ul>
</div>
add a comment
|
If you want Home, Features and Pricing on left immediately after your nav-brand, and then login and register on right then wrap the two lists in <div> and use .justify-content-between:
<div class="collapse navbar-collapse justify-content-between">
<ul>....</ul>
<ul>...</ul>
</div>
add a comment
|
If you want Home, Features and Pricing on left immediately after your nav-brand, and then login and register on right then wrap the two lists in <div> and use .justify-content-between:
<div class="collapse navbar-collapse justify-content-between">
<ul>....</ul>
<ul>...</ul>
</div>
If you want Home, Features and Pricing on left immediately after your nav-brand, and then login and register on right then wrap the two lists in <div> and use .justify-content-between:
<div class="collapse navbar-collapse justify-content-between">
<ul>....</ul>
<ul>...</ul>
</div>
edited Aug 1 '17 at 6:22
Billal Begueradj
6,57914 gold badges40 silver badges64 bronze badges
6,57914 gold badges40 silver badges64 bronze badges
answered Jun 8 '17 at 22:12
J KennedyJ Kennedy
611 silver badge3 bronze badges
611 silver badge3 bronze badges
add a comment
|
add a comment
|
Just add mr-auto class at ul
<ul class="nav navbar-nav mr-auto">
If you have menu list in both side you can do something like this:
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">left 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">left 2</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">left disable</a>
</li>
</ul>
add a comment
|
Just add mr-auto class at ul
<ul class="nav navbar-nav mr-auto">
If you have menu list in both side you can do something like this:
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">left 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">left 2</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">left disable</a>
</li>
</ul>
add a comment
|
Just add mr-auto class at ul
<ul class="nav navbar-nav mr-auto">
If you have menu list in both side you can do something like this:
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">left 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">left 2</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">left disable</a>
</li>
</ul>
Just add mr-auto class at ul
<ul class="nav navbar-nav mr-auto">
If you have menu list in both side you can do something like this:
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">left 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">left 2</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">left disable</a>
</li>
</ul>
edited Jul 24 '17 at 15:53
answered Jul 24 '17 at 9:44
SKLSKL
3707 silver badges20 bronze badges
3707 silver badges20 bronze badges
add a comment
|
add a comment
|
use the flex-row-reverse class
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<i class="fa fa-hospital-o fa-2x" aria-hidden="true"></i>
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li><a class="nav-item nav-link active" href="#" style="background-color:#666">Home <span class="sr-only">(current)</span></a</li>
<li><a class="nav-item nav-link" href="#">Doctors</a></li>
<li><a class="nav-item nav-link" href="#">Specialists</a></li>
<li><a class="nav-item nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
add a comment
|
use the flex-row-reverse class
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<i class="fa fa-hospital-o fa-2x" aria-hidden="true"></i>
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li><a class="nav-item nav-link active" href="#" style="background-color:#666">Home <span class="sr-only">(current)</span></a</li>
<li><a class="nav-item nav-link" href="#">Doctors</a></li>
<li><a class="nav-item nav-link" href="#">Specialists</a></li>
<li><a class="nav-item nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
add a comment
|
use the flex-row-reverse class
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<i class="fa fa-hospital-o fa-2x" aria-hidden="true"></i>
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li><a class="nav-item nav-link active" href="#" style="background-color:#666">Home <span class="sr-only">(current)</span></a</li>
<li><a class="nav-item nav-link" href="#">Doctors</a></li>
<li><a class="nav-item nav-link" href="#">Specialists</a></li>
<li><a class="nav-item nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
use the flex-row-reverse class
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<i class="fa fa-hospital-o fa-2x" aria-hidden="true"></i>
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNavAltMarkup">
<ul class="navbar-nav">
<li><a class="nav-item nav-link active" href="#" style="background-color:#666">Home <span class="sr-only">(current)</span></a</li>
<li><a class="nav-item nav-link" href="#">Doctors</a></li>
<li><a class="nav-item nav-link" href="#">Specialists</a></li>
<li><a class="nav-item nav-link" href="#">About</a></li>
</ul>
</div>
</div>
</nav>
edited Oct 30 '17 at 17:25
udo
2,0213 gold badges33 silver badges52 bronze badges
2,0213 gold badges33 silver badges52 bronze badges
answered Oct 9 '17 at 19:31
mubshermubsher
2403 silver badges15 bronze badges
2403 silver badges15 bronze badges
add a comment
|
add a comment
|
Use this code for move items to right.
div class="collapse navbar-collapse justify-content-end"
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
add a comment
|
Use this code for move items to right.
div class="collapse navbar-collapse justify-content-end"
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
add a comment
|
Use this code for move items to right.
div class="collapse navbar-collapse justify-content-end"
Use this code for move items to right.
div class="collapse navbar-collapse justify-content-end"
answered Mar 2 '18 at 4:33
Maijied Hasan ShuvoMaijied Hasan Shuvo
2924 silver badges10 bronze badges
2924 silver badges10 bronze badges
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
add a comment
|
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
that will not work when you have a collapsed Menu, however, with the ml-auto it will still work because when the menu is collapsed, the <li> items still take 100% of the width so no margin will be applied.
– Ryan S
Nov 20 '18 at 5:32
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
Its working in bootstrap 4...
– Sam
Feb 5 at 5:46
add a comment
|
I am running Angular 4 (v.4.0.0) and ng-bootstrap (Bootstrap 4). This code won't all be relevant but hoping people can pick and choose what works. It took me sometime to find a solution to get my items to justify right, collapse properly and to implement a dropdown off my google (using OAuth) profile picture.
<div id="header" class="header">
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<img alt='Brand' src='../assets/images/logo-white.png' class='navbar-logo-img d-inline-block align-top '>
<span class="navbar-logo-text">Oncoscape</span>
</a>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav float-left">
<a class="navbar-items nav-item nav-link active " *ngIf='authenticated' (click)='goDashboard()'>
<span class="fa fa-dashboard"></span>Dashboard
</a>
<a class="nav-item nav-link navbar-items active" href="http://resources.sttrcancer.org/oncoscape-contact">
<span class="fa fa-comments"></span>Feedback
</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img *ngIf='user && authenticated' class="navbar-pic" src=user.thumbnail alt="Smiley face">
</a>
<div *ngIf='user && authenticated' class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" (click)="toProfile()">Account</a>
<div class="dropdown-item">
<app-login></app-login>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
<router-outlet></router-outlet>
add a comment
|
I am running Angular 4 (v.4.0.0) and ng-bootstrap (Bootstrap 4). This code won't all be relevant but hoping people can pick and choose what works. It took me sometime to find a solution to get my items to justify right, collapse properly and to implement a dropdown off my google (using OAuth) profile picture.
<div id="header" class="header">
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<img alt='Brand' src='../assets/images/logo-white.png' class='navbar-logo-img d-inline-block align-top '>
<span class="navbar-logo-text">Oncoscape</span>
</a>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav float-left">
<a class="navbar-items nav-item nav-link active " *ngIf='authenticated' (click)='goDashboard()'>
<span class="fa fa-dashboard"></span>Dashboard
</a>
<a class="nav-item nav-link navbar-items active" href="http://resources.sttrcancer.org/oncoscape-contact">
<span class="fa fa-comments"></span>Feedback
</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img *ngIf='user && authenticated' class="navbar-pic" src=user.thumbnail alt="Smiley face">
</a>
<div *ngIf='user && authenticated' class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" (click)="toProfile()">Account</a>
<div class="dropdown-item">
<app-login></app-login>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
<router-outlet></router-outlet>
add a comment
|
I am running Angular 4 (v.4.0.0) and ng-bootstrap (Bootstrap 4). This code won't all be relevant but hoping people can pick and choose what works. It took me sometime to find a solution to get my items to justify right, collapse properly and to implement a dropdown off my google (using OAuth) profile picture.
<div id="header" class="header">
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<img alt='Brand' src='../assets/images/logo-white.png' class='navbar-logo-img d-inline-block align-top '>
<span class="navbar-logo-text">Oncoscape</span>
</a>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav float-left">
<a class="navbar-items nav-item nav-link active " *ngIf='authenticated' (click)='goDashboard()'>
<span class="fa fa-dashboard"></span>Dashboard
</a>
<a class="nav-item nav-link navbar-items active" href="http://resources.sttrcancer.org/oncoscape-contact">
<span class="fa fa-comments"></span>Feedback
</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img *ngIf='user && authenticated' class="navbar-pic" src=user.thumbnail alt="Smiley face">
</a>
<div *ngIf='user && authenticated' class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" (click)="toProfile()">Account</a>
<div class="dropdown-item">
<app-login></app-login>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
<router-outlet></router-outlet>
I am running Angular 4 (v.4.0.0) and ng-bootstrap (Bootstrap 4). This code won't all be relevant but hoping people can pick and choose what works. It took me sometime to find a solution to get my items to justify right, collapse properly and to implement a dropdown off my google (using OAuth) profile picture.
<div id="header" class="header">
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">
<img alt='Brand' src='../assets/images/logo-white.png' class='navbar-logo-img d-inline-block align-top '>
<span class="navbar-logo-text">Oncoscape</span>
</a>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav float-left">
<a class="navbar-items nav-item nav-link active " *ngIf='authenticated' (click)='goDashboard()'>
<span class="fa fa-dashboard"></span>Dashboard
</a>
<a class="nav-item nav-link navbar-items active" href="http://resources.sttrcancer.org/oncoscape-contact">
<span class="fa fa-comments"></span>Feedback
</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img *ngIf='user && authenticated' class="navbar-pic" src=user.thumbnail alt="Smiley face">
</a>
<div *ngIf='user && authenticated' class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" (click)="toProfile()">Account</a>
<div class="dropdown-item">
<app-login></app-login>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
<router-outlet></router-outlet>
answered Aug 11 '17 at 0:50
GrettyGooseGrettyGoose
11 bronze badge
11 bronze badge
add a comment
|
add a comment
|
For Bootstrap 4 beta, sample navbar with elements aligned to the right side is:
<div id="app" class="container">
<nav class="navbar navbar-expand-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
add a comment
|
For Bootstrap 4 beta, sample navbar with elements aligned to the right side is:
<div id="app" class="container">
<nav class="navbar navbar-expand-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
add a comment
|
For Bootstrap 4 beta, sample navbar with elements aligned to the right side is:
<div id="app" class="container">
<nav class="navbar navbar-expand-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
For Bootstrap 4 beta, sample navbar with elements aligned to the right side is:
<div id="app" class="container">
<nav class="navbar navbar-expand-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
</div>
answered Aug 19 '17 at 21:31
KaczorKaczor
1
1
add a comment
|
add a comment
|
Using the bootstrap flex box helps
us to control the placement and alignment of your navigation element.
for the problem above adding mr-auto is a better solution to it .
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
other placement may include
fixed- top
fixed bottom
sticky-top
add a comment
|
Using the bootstrap flex box helps
us to control the placement and alignment of your navigation element.
for the problem above adding mr-auto is a better solution to it .
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
other placement may include
fixed- top
fixed bottom
sticky-top
add a comment
|
Using the bootstrap flex box helps
us to control the placement and alignment of your navigation element.
for the problem above adding mr-auto is a better solution to it .
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
other placement may include
fixed- top
fixed bottom
sticky-top
Using the bootstrap flex box helps
us to control the placement and alignment of your navigation element.
for the problem above adding mr-auto is a better solution to it .
<div id="app" class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav " >
<li class="nav-item">
<a class="nav-link" href=" url('/login') ">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href=" url('/register') ">Register</a>
</li>
</ul>
</nav>
@yield('content')
</div>
other placement may include
fixed- top
fixed bottom
sticky-top
answered Oct 23 '17 at 9:06
maromaro
1
1
add a comment
|
add a comment
|
The working example for BS v4.0.0-beta.2:
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
container content
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
add a comment
|
The working example for BS v4.0.0-beta.2:
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
container content
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
add a comment
|
The working example for BS v4.0.0-beta.2:
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
container content
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
The working example for BS v4.0.0-beta.2:
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricingg</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Register</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
container content
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
edited Nov 14 '17 at 9:44
answered Nov 14 '17 at 9:23
belgorosbelgoros
1,7483 gold badges11 silver badges25 bronze badges
1,7483 gold badges11 silver badges25 bronze badges
add a comment
|
add a comment
|
If all above fails, I added 100% width to the navbar class in CSS. Until then mr auto wasn't working for me on this project using 4.1.
add a comment
|
If all above fails, I added 100% width to the navbar class in CSS. Until then mr auto wasn't working for me on this project using 4.1.
add a comment
|
If all above fails, I added 100% width to the navbar class in CSS. Until then mr auto wasn't working for me on this project using 4.1.
If all above fails, I added 100% width to the navbar class in CSS. Until then mr auto wasn't working for me on this project using 4.1.
answered May 19 '18 at 20:52
Dominic DaviesDominic Davies
695 bronze badges
695 bronze badges
add a comment
|
add a comment
|
Find the 69 line in the verndor-prefixes.less and write it following:
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
add a comment
|
Find the 69 line in the verndor-prefixes.less and write it following:
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
add a comment
|
Find the 69 line in the verndor-prefixes.less and write it following:
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
Find the 69 line in the verndor-prefixes.less and write it following:
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
.panel
margin-bottom: 20px;
height: 100px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
edited Jan 10 '18 at 4:08
meagar♦
189k32 gold badges285 silver badges300 bronze badges
189k32 gold badges285 silver badges300 bronze badges
answered Sep 21 '17 at 8:51
PaulPaul
193 bronze badges
193 bronze badges
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
add a comment
|
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
This isn't even Bootstrap code.
– Zim
Dec 20 '18 at 21:52
add a comment
|
Just copied this from one of the getbootstrap pages for the released version 4 which worked much better than the above
<div class="d-none d-xl-block col-xl-2 bd-toc float-md-right">
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#overview">Overview</a></li>
<li class="toc-entry toc-h2"><a href="#classes">Classes</a></li>
<li class="toc-entry toc-h2"><a href="#mixins">Mixins</a></li>
<li class="toc-entry toc-h2"><a href="#responsive">Responsive</a></li>
</ul>
</div>
add a comment
|
Just copied this from one of the getbootstrap pages for the released version 4 which worked much better than the above
<div class="d-none d-xl-block col-xl-2 bd-toc float-md-right">
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#overview">Overview</a></li>
<li class="toc-entry toc-h2"><a href="#classes">Classes</a></li>
<li class="toc-entry toc-h2"><a href="#mixins">Mixins</a></li>
<li class="toc-entry toc-h2"><a href="#responsive">Responsive</a></li>
</ul>
</div>
add a comment
|
Just copied this from one of the getbootstrap pages for the released version 4 which worked much better than the above
<div class="d-none d-xl-block col-xl-2 bd-toc float-md-right">
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#overview">Overview</a></li>
<li class="toc-entry toc-h2"><a href="#classes">Classes</a></li>
<li class="toc-entry toc-h2"><a href="#mixins">Mixins</a></li>
<li class="toc-entry toc-h2"><a href="#responsive">Responsive</a></li>
</ul>
</div>
Just copied this from one of the getbootstrap pages for the released version 4 which worked much better than the above
<div class="d-none d-xl-block col-xl-2 bd-toc float-md-right">
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#overview">Overview</a></li>
<li class="toc-entry toc-h2"><a href="#classes">Classes</a></li>
<li class="toc-entry toc-h2"><a href="#mixins">Mixins</a></li>
<li class="toc-entry toc-h2"><a href="#responsive">Responsive</a></li>
</ul>
</div>
edited Feb 12 '18 at 11:57
ata
1,2964 gold badges14 silver badges25 bronze badges
1,2964 gold badges14 silver badges25 bronze badges
answered Feb 12 '18 at 11:14
Gary MoltonGary Molton
1
1
add a comment
|
add a comment
|
I'm new to stack overflow and new to front end development. This is what worked for me. So I did not want list items to be displayed.
.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>add a comment
|
I'm new to stack overflow and new to front end development. This is what worked for me. So I did not want list items to be displayed.
.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>add a comment
|
I'm new to stack overflow and new to front end development. This is what worked for me. So I did not want list items to be displayed.
.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>I'm new to stack overflow and new to front end development. This is what worked for me. So I did not want list items to be displayed.
.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>.hidden
display:none;
#loginButton
margin-right:2px;
<nav class="navbar navbar-toggleable-md navbar-light bg-faded fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">NavBar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active hidden">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item hidden">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item hidden">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" id="loginButton"><a href="#">Log In</a></button>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><a href="#">Register</a></button>
</form>
</div>
</nav>answered Apr 3 '17 at 11:57
MSanghaMSangha
234 bronze badges
234 bronze badges
add a comment
|
add a comment
|
protected by Zim Mar 6 '18 at 13:46
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Navbars are built with flexbox from alpha 6 version.
– max
Jan 6 '17 at 20:06
Yes, so what do I have to do to get it to align to the right. I've already tried a couple flexbox things without any luck. :/
– Luuk Wuijster
Jan 6 '17 at 20:12