I'm using the NgbDropdown
component in my Angular 2 application. It is working fine, however I want to remove the arrow that is displayed on the right side of the button.
<div class="d-inline-block" ngbDropdown #myDrop="ngbDropdown">
<button class="btn btn-outline-primary" id="dropdownMenu1" ngbDropdownToggle>Toggle dropdown</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu1">
<button class="dropdown-item">Action - 1</button>
<button class="dropdown-item">Another Action</button>
<button class="dropdown-item">Something else is here</button>
</div>
</div>
Simply add the following CSS style to override the default style of the .dropdown-toggle::after
pseudo-element:
.dropdown-toggle::after {
display:none;
}
By default bootstrap adds the arrow to the dropdown component via the ::after
pseudo-element.
Doing this removes it.
Here is a LIVE DEMO demonstrating it.
Using chrome dev tools you can inspect the element:
We can see from the above that there is a style set for a pseudo-element ::after on the .dropdown-toggle
class. Let's go and change the properties of the element! For this purpose we are changing the display
property to none
:
The pseudo-element is no longer there!!: