Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap remove upward arrow in dropdown

I am using Twitter bootstap and wish to remove the upward arrow on the dropdown-menu whis is in my nav. I cannot find a reference in the bootstrap.css.

Bootstrap

.navbar .dropdown-menu:after {
 content: '';
 display: inline-block;
 border-left: 6px solid transparent;
 border-right: 6px solid transparent;
 border-bottom: 6px solid #000; /* change color here, modified for a black arrow */
 position: absolute;
 top: -6px;
 left: 10px;
}
like image 869
Keith Power Avatar asked Apr 03 '13 15:04

Keith Power


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 remove the arrow from a drop down list?

Setting this property to “none” will do the job. It explicitly tells the browser to not assign any other value to that property, which in turn results in the removal of the default arrow icon.

How do you put a drop down arrow under a caret in bootstrap 4?

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.


1 Answers

I would not recommend you to edit the bootstrap.css file. You can overwrite the styling in your custom stylesheet to hide the arrow for that component like this:

.dropdown-menu:after {
    border: none !important;
    content: "" !important;
}

With this method you can even do the overwriting for a specific dropdown only. For example, if your dropdown was a child of an element with the id my_dropdown, you could do:

#my_dropdown .dropdown-menu:after {
    border: none !important;
    content: "" !important;
}

This would allow you to have an arrow for other dropdowns, while hiding it for this specific dropdown.

like image 157
Shef Avatar answered Oct 13 '22 20:10

Shef