How can I remove the arrow from drop down list in

2020-05-23 09:04发布

问题:

I am trying to remove the arrow that appears on a drop down menu in Twitter Bootstrap framework. Has anyone figured a way of removing the arrows?

回答1:

From: https://getbootstrap.com/2.3.2/components.html#buttonDropdowns

<div class="btn-group">
  <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
    Action
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu">
    <!-- dropdown menu links -->
  </ul>
</div>

If you remove <span class="caret"></span> the arrow is not shown.

Tried it using the dev. console in Chrome, and seems to work.



回答2:

Removing the caret class from the link removes the arrow from the navigation bar,

.dropdown-menu::before, 
.dropdown-menu::after {
    border: none;
    content: none;
}

Will remove the little tab from the drop down menu its self.



回答3:

If you copy an existing Bootstrap dropdown example, the menu button tag looks something like this:

<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Menu Name</button>

Removing the dropdown-toggle class removes the arrow (or caret):

<button class="btn btn-primary" type="button" data-toggle="dropdown">Menu Name</button>


回答4:

Just remove border-bottom from dropdown-menu will remove arrow from the navigation bar.

.navbar .nav > li > .dropdown-menu:before, .navbar .nav > li > .dropdown-menu:after{
    border-bottom: none;
}


回答5:

I've found the best solution is to add overflow:hidden; to .dropdown-menu



回答6:

.dropdown-toggle::after{
    display: none;
}


回答7:

add .dropdown-toggle-split class in the tag



回答8:

The only thing that worked for me was that I removed class="caret" if you are using bootstrap dropdown. Hope this work for you too.



回答9:

In Bootstrap4 remove "dropdown-toggle" class from "a" element.