How to remove arrow in dropdown in Bootstrap ?
Dropdowns are one of the important components that are an integral part of any web application. Bootstrap provides its own interactive version of this component. Bootstrap dropdowns are toggled by clicking, not hovering as it was an intentional design decision. To use Dropdowns in a web project, include Popper.js into the project.
Every Bootstrap dropdown button or link has an ::after selector in CSS. ::after selector is often used to insert some text after the content of the element. In this case, the content is a dropdown arrow. To remove it, just make the content go ‘none’.
Syntax:
.my-dropdown-toggle::after {
content: none;
}
One can use this feature to create navigation menus in top navbars. Here’s the complete example showing how to do it.
Example 1:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content= "width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href= <title>Remove Dropdown Arrow</title> <style> .dropdown-toggle::after { content: none; } </style> </head> <body> <div class="container"> <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropdown button </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <a class="dropdown-item" href="#"> Action </a> <a class="dropdown-item" href="#"> Another action </a> <a class="dropdown-item" href="#"> Something else here </a> </div> </div> </div> <script src= </script> <script src= </script> <script src= </script> </body> </html> |
Output:

Example 2: Remove arrow in dropdown with some changes in class name.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content= "width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href= <title>Remove Dropdown Arrow</title> </head> <body> <div class="container"> <div class="dropdown"> <button class="btn btn-secondary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropdown button </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <a class="dropdown-item" href="#"> Action </a> <a class="dropdown-item" href="#"> Another action </a> <a class="dropdown-item" href="#"> Something else here </a> </div> </div> </div> <script src= </script> <script src= </script> <script src= </script> </body> </html> |
Output:

Recommended Posts:
- How to open dropdown menu on hover in Bootstrap ?
- How to remove active nav-tab when click outside of nav-tab in Bootstrap ?
- How to style a dropdown using CSS?
- How to clear all options in a dropdown box?
- How to get selected value in dropdown list using JavaScript ?
- How to display div elements using Dropdown Menu in jQuery?
- Include Bootstrap in AngularJS using ng-bootstrap
- Arrow operator in ES6 of JavaScript
- Arrow functions in JavaScript
- JavaScript | Detecting the pressed arrow key
- How to disable arrow key in textarea using JavaScript ?
- How to move an element to left, right, up and down using arrow keys ?
- Higher-Order Arrow Functions in JavaScript
- How to avoid dropdown menu to close menu items on clicking inside ?
- Difference between regular functions and arrow functions
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



