Create a caret arrow icon that represents dropdown button with Bootstrap


Use the .caret class in Bootstrap to create a caret arrow icon representing dropdown button.

You can try to run the following code to create a carot arrow icon −

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class="container">
         <h2>Brands</h2>
         <p>The car brands:</p>
         <div class = "btn-group">
            <button type = "button" class = "btn dropdown-toggle" data-toggle = "dropdown">Car <span class="caret"></span></button>
            <ul class = "dropdown-menu" role = "menu">
               <li><a href = "#">BMW</a></li>
               <li><a href = "#">Toyota</a></li>
               <li><a href = "#">Audi</a></li>
               <li><a href = "#">Mahindra</a></li>
               <li><a href = "#">Volvo</a></li>
            </ul>
         </div>
      </div>
   </body>
</html>

Updated on: 12-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements