Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Navbar Dropdown Menu Items Right

As you see in the picture below, when I click on the bell icon, a dropdown menu appears at the bottom-right of the icon. I want this dropdown menu to appear at bottom-left instead of bottom-right. What should I do?

enter image description here

<nav class="navbar">   <div class="container">     <div class="navbar-nav d-flex flex-row">       ...     </div>   </div> </nav> 
like image 322
eylay Avatar asked May 09 '17 10:05

eylay


People also ask

How do I change the position of a drop down menu in Bootstrap?

Use data-offset or data-reference to change the location of the dropdown.

How do I put navbar items right?

ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.

How do I align a drop down to the right in HTML?

Use the w3-right class to float the dropdown to the right, and use CSS to position the dropdown content (right:0 will make the dropdown menu go from right to left).

How do I add a caret in dropdown?

Basic Dropdown To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute. The . caret class creates a caret arrow icon (), which indicates that the button is a dropdown.

How to align items to the right in Bootstrap 5 navbar?

By default, the Bootstrap 5 navbar components are aligned to the left. Here, we will learn to align items to the right. As the navbar is built with flexbox. The navbar items can be aligned using flex utility. Use .justify-content-end class on collapse menu to justify items to the right.

How do I add a dropdown menu to a navigation bar?

Just change the .navbar-default class into .navbar-inverse: Navigation bars can also hold dropdown menus. The following example adds a dropdown menu for the "Page 1" button: The .navbar-right class is used to right-align navigation bar buttons.

What are the different types of navigation bars in Bootstrap?

1 Navigation Bars. With Bootstrap, a navigation bar can extend or collapse, depending on the screen size. ... 2 Inverted Navigation Bar 3 Navigation Bar With Dropdown. Navigation bars can also hold dropdown menus. 4 Right-Aligned Navigation Bar. ... 5 Navbar Buttons 6 Navbar Forms. ... 7 Navbar Text. ... 8 Fixed Navigation Bar. ...

What is the latest bootstrap version for drop down menu?

Bootstrap version: 3.3.0 Author bestjquery Links demo and code Made with HTML / CSS / JS About a code Bootstrap Dropdown Menu Style 83 Compatible browsers: Chrome, Edge, Firefox, Opera, Safari Responsive: yes Dependencies: bootsnav.css, jquery.js, bootsnav.js Bootstrap version: 3.3.0


Video Answer


1 Answers

Bootstrap 5 (update 2021)

Use the dropdown-menu-end class on the dropdown-menu to align the items inside the menu right..

<div class="dropdown-menu dropdown-menu-end">     <a class="dropdown-item" href="#">Link</a>     <a class="dropdown-item" href="#">Link</a>     <a class="dropdown-item" href="#">Link</a> </div> 

https://codeply.com/p/kWLLKdjdpC

Bootstrap 4 (original answer)

Use the dropdown-menu-right class to align the items inside the menu right..

<div class="dropdown-menu dropdown-menu-right text-right">     <a class="dropdown-item" href="#">Link</a>     <a class="dropdown-item" href="#">Link</a>     <a class="dropdown-item" href="#">Link</a> </div> 

http://codeply.com/go/6Mf9aK0P8G

like image 158
Zim Avatar answered Sep 19 '22 20:09

Zim