csstwitter-bootstrap

Bootstrap 5 Floating Action Button


I have the following code to represent a floating action button:

.dropup .hide-toggle.dropdown-toggle::after {
    display: none !important;
}
<div class="dropup position-absolute bottom-0 end-0 rounded-circle m-5">
    <button type="button" class="btn btn-success btn-lg dropdown-toggle hide-toggle" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">
        <i class="fa-solid fa-plus"></i>
        <span class="visually-hidden">Add Category</span>
    </button>
    <ul class="dropdown-menu">
        <li>
            <a class="dropdown-item" href="#">...</a>
        </li>
    </ul>
</div>

But I'm having an issue hiding the toggle icon in the .dropdown-toggle despite having a CSS rule to have it not display.

What can I do to remove the icon?


Solution

  • Are you sure it's not working? I see no icon here.

    .dropup .hide-toggle.dropdown-toggle::after {
      display: none !important;
    }
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
    
    <div class="dropup position-absolute bottom-0 end-0 rounded-circle m-5">
      <button type="button" class="btn btn-success btn-lg dropdown-toggle hide-toggle" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">
        <i class="fa-solid fa-plus"></i>
        <span class="visually-hidden">Add Category</span>
      </button>
      <ul class="dropdown-menu">
        <li>
          <a class="dropdown-item" href="#">...</a>
        </li>
      </ul>
    </div>