Headers,Dividers and Text
WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Bootstrap 4 - Dropdowns


Add dropdown menus with out writing any JavaScript.

Bootstrap consists of a aspect for adding dropdown menus. The JavaScript is blanketed with the default Bootstrap JS report and you can use it without a doubt with the aid of adding the CSS instructions — no similarly JavaScript required.

<html lang = "en">
   <head>
      <!-- Meta tags -->
      <meta charset = "utf-8">
      <meta name = "viewport" content material = "width = tool-width, preliminary-scale = 1, shrink-to-match = no">
      
      <!-- Bootstrap CSS -->
      <hyperlink rel = "stylesheet" 
         href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/css/bootstrap.Min.Css" 
         integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" 
         crossorigin = "nameless">
      
      <name>Bootstrap four Example</name>
   </head>
   
   <body>
      <div class = "field">
      <h2>Basic Dropdown</h2>
         <div class = "row">
            <div magnificence = "dropdown">
               <button elegance = "btn btn-data dropdown-toggle" kind = "button" 
                  identity = "dropdownMenuButton" information-toggle = "dropdown" aria-haspopup = "genuine" 
                  aria-accelerated = "fake">Dropdown button</button>
               
               <div elegance = "dropdown-menu" aria-labelledby = "dropdownMenuButton">
                  <a magnificence = "dropdown-object" href = "#">Home</a>
                  <a elegance = "dropdown-object" href = "#">About Us</a>
                  <a class = "dropdown-object" href = "#">Contact Us</a>
               </div>
            </div>
         </div>
      </div>
      
      <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
      <script src = "https://code.Jquery.Com/jquery-3.Three.1.Slender.Min.Js" 
         integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
         crossorigin = "anonymous">
      </script>
      
      <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.3/umd/popper.Min.Js" 
         integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 
         crossorigin = "nameless">
      </script>
      
      <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.3/js/bootstrap.Min.Js" 
         integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" 
         crossorigin = "nameless">
      </script>
      
   </frame>
</html>

It will produce the subsequent result −

Output

Dropdown with Split Buttons

You can create split button dropdown through the use of the .Dropdown-toggle-cut upelegance, which gives area around the dropdown caret and button.

The following example demonstrates this −

<html lang = "en">
   <head>
      <!-- Meta tags -->
      <meta charset = "utf-8">
      <meta call = "viewport" content material = "width = tool-width, preliminary-scale = 1, decrease-to-in shape = no">
      
      <!-- Bootstrap CSS -->
      <link rel = "stylesheet" 
         href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.3/css/bootstrap.Min.Css" 
         integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" 
         crossorigin = "nameless">
      
      <identify>Bootstrap four Example</name>
   </head>
   
   <frame>
      <div class = "container">
         <h2>Dropdown with Split Buttons</h2>
         <div class = "row">
            <div elegance = "btn-organization">
               <button kind = "button" elegance = "btn btn-number one">Primary</button>
               <button kind = "button" elegance = "btn btn-primary 
                  dropdown-toggle dropdown-toggle-break up" data-toggle = "dropdown">
               </button>
               
               <div magnificence = "dropdown-menu">
                  <a elegance = "dropdown-item" href = "#">Home</a>
                  <a magnificence = "dropdown-item" href = "#">About Us</a>
                  <a elegance = "dropdown-item" href = "#">Contact Us</a>
               </div>
            </div>
             
            
            <div class = "btn-organization">
               <button kind = "button" elegance = "btn btn-secondary">Secondary</button>
               <button kind = "button" class = "btn btn-secondary dropdown-toggle dropdown-toggle-break up" statistics-toggle = "dropdown">
               </button>
               
               <div magnificence = "dropdown-menu">
                  <a class = "dropdown-object" href = "#">Home</a>
                  <a elegance = "dropdown-object" href = "#">About Us</a>
                  <a class = "dropdown-item" href = "#">Contact Us</a>
               </div>
            </div>
             
            
            <div elegance = "btn-organization">
               <button kind =" button" magnificence = "btn btn-success">Success</button>
               <button kind = "button" magnificence = "btn btn-success dropdown-toggle dropdown-toggle-break up" records-toggle = "dropdown">
               </button>
               <div class = "dropdown-menu">
                  <a magnificence = "dropdown-item" href = "#">Home</a>
                  <a class = "dropdown-object" href = "#">About Us</a>
                  <a class = "dropdown-object" href = "#">Contact Us</a>
               </div>
            </div>
             
            
            <div class = "btn-institution">
               <button kind = "button" class = "btn btn-info">Info</button>
               <button kind = "button" elegance = "btn btn-information dropdown-toggle dropdown-toggle-break up" data-toggle = "dropdown">
               </button>
               <div elegance = "dropdown-menu">
                  <a magnificence = "dropdown-object" href = "#">Home</a>
                  <a magnificence = "dropdown-object" href = "#">About Us</a>
                  <a elegance = "dropdown-item" href = "#">Contact Us</a>
               </div>
            </div>
             
            
            <div elegance = "btn-group">
               <button type = "button" class = "btn btn-warning">Warning</button>
               <button type = "button" class = "btn btn-caution dropdown-toggle dropdown-toggle-cut up" data-toggle = "dropdown">
               </button>
               <div magnificence = "dropdown-menu">
                  <a elegance = "dropdown-object" href = "#">Home</a>
                  <a elegance = "dropdown-item" href = "#">About Us</a>
                  <a magnificence = "dropdown-item" href = "#">Contact Us</a>
               </div>
            </div>
             
            
            <div class = "btn-group">
               <button kind = "button" elegance = "btn btn-hazard">Danger</button>
               <button type = "button" elegance = "btn btn-risk dropdown-toggle dropdown-toggle-split" statistics-toggle = "dropdown">
               </button>
               <div class = "dropdown-menu">
                  <a class = "dropdown-object" href = "#">Home</a>
                  <a elegance = "dropdown-object" href = "#">About Us</a>
                  <a class = "dropdown-item" href = "#">Contact Us</a>
               </div>
            </div>
         </div>
      </div>
      
      <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
      <script src = "https://code.Jquery.Com/jquery-three.Three.1.Narrow.Min.Js" 
         integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
         crossorigin = "nameless">
      </script>
      
      <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js" 
         integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 
         crossorigin = "anonymous">
      </script>
      
      <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.3/js/bootstrap.Min.Js" 
         integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" 
         crossorigin = "anonymous">
      </script>
      
   </frame>
</html>

It will produce the following end result −

Output

Dropdown Sizes and Split Buttons

Dropdown buttons can be displayed in huge and small sizes with the aid of using btn-lg and btn-sm classes, inclusive of cut up dropdown buttons.

<html lang = "en">
   <head>
      <!-- Meta tags -->
      <meta charset = "utf-8">
      <meta call = "viewport" content material = "width = device-width, preliminary-scale = 1, reduce-to-healthy = no">
      
      <!-- Bootstrap CSS -->
      <hyperlink rel = "stylesheet" 
         href = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.3/css/bootstrap.Min.Css" 
         integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" 
         crossorigin = "anonymous">
      
      <identify>Bootstrap 4 Example</identify>
   </head>
   
   <body>
      <div magnificence = "box">
         <h2>Dropdown Sizes and Split Buttons</h2>
         <div magnificence = "btn-group">
            <button magnificence = "btn btn-information btn-lg dropdown-toggle" type = "button" 
               data-toggle = "dropdown" aria-haspopup = "actual" aria-expanded = "false">
               
               Large button
            </button>
            <div elegance = "dropdown-menu">
               <a elegance = "dropdown-object" href = "#">Home</a>
               <a elegance = "dropdown-object" href = "#">About Us</a>
               <a magnificence = "dropdown-item" href =" #">Contact Us</a>
            </div>
         </div>
         
         <div elegance = "btn-institution">
            <button elegance = "btn btn-data btn-lg" kind = "button">
               Large break up button
            </button>
            
            <button type = "button" elegance = "btn btn-lg btn-data dropdown-toggle dropdown-toggle-break up" 
               statistics-toggle = "dropdown" aria-haspopup = "real" aria-expanded = "false">
               <span magnificence = "sr-most effective">Toggle Dropdown</span>
            </button>
            
            <div magnificence = "dropdown-menu">
               <a class = "dropdown-item" href = "#">Home</a>
               <a magnificence = "dropdown-item" href = "#">About Us</a>
               <a class = "dropdown-item" href = "#">Contact Us</a>
            </div>
         </div>
         <br>
         <br>
         
         <div magnificence = "btn-group">
            <button magnificence = "btn btn-info btn-sm dropdown-toggle" kind = "button" 
               data-toggle = "dropdown" aria-haspopup = "proper" aria-accelerated = "fake">
               
               Small button
            </button>
            <div magnificence = "dropdown-menu">
               <a class = "dropdown-item" href = "#">Home</a>
               <a elegance = "dropdown-object" href = "#">About Us</a>
               <a elegance = "dropdown-object" href = "#">Contact Us</a>
            </div>
         </div>
         
         <div magnificence = "btn-organization">
            <button class = "btn btn-info btn-sm" kind = "button">
               Small cut up button
            </button>
            <button kind = "button" class = "btn btn-sm btn-information dropdown-toggle dropdown-toggle-break up" 
               statistics-toggle = "dropdown" aria-haspopup = "authentic" aria-increased = "fake">
               <span elegance = "sr-handiest">Toggle Dropdown</span>
            </button>
            
            <div class = "dropdown-menu">
               <a magnificence = "dropdown-object" href = "#">Home</a>
               <a class = "dropdown-object" href = "#">About Us</a>
               <a class = "dropdown-object" href = "#">Contact Us</a>
            </div>
         </div>
      </div>
      
      <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
      <script src = "https://code.Jquery.Com/jquery-three.3.1.Slender.Min.Js" 
         integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
         crossorigin = "anonymous">
      </script>
      
      <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js" 
         integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 
         crossorigin = "nameless">
      </script>
      
      <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.3/js/bootstrap.Min.Js" 
         integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" 
         crossorigin = "nameless">
      </script>
      
   </frame>
</html>

It will produce the following end result −

Output

Headers,Dividers and Text

Use the .Dropdown-header elegance to feature headers within the dropdown menu, the .Dropdown-divider elegance provides divider to dropdown menu with a skinny horizontal border and the .Dropdown-object-textual content magnificence is used to place textual content within a dropdown menu.

<html lang = "en">
   <head>
      <!-- Meta tags -->
      <meta charset = "utf-8">
      <meta call = "viewport" content = "width = tool-width, preliminary-scale = 1, cut back-to-suit = no">
      
      <!-- Bootstrap CSS -->
      <hyperlink rel = "stylesheet" 
         href = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.3/css/bootstrap.Min.Css" 
         integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" 
         crossorigin = "anonymous">
      
      <title>Bootstrap four Example</title>
   </head>
   
   <frame>
      <div class = "box">
         <h2>Headers</h2>
         <div elegance = "btn-institution dropright">
            <button kind = "button" class = "btn btn-information dropdown-toggle" 
               facts-toggle = "dropdown" aria-haspopup = "true" aria-multiplied = "fake">
            
               Headers Example
            </button>
            <div magnificence = "dropdown-menu p-4 text-muted">
               <h6 elegance = "dropdown-header">This is Header</h6>
               <a magnificence = "dropdown-object" href = "#">Home</a>
               <a elegance = "dropdown-object" href = "#">About Us</a>
               <a class = "dropdown-object" href = "#">Contact Us</a>  
            </div>
         </div>
         <br>
         <br>
         
         <h2>Dividers</h2>
         <div class = "btn-institution dropright">
            <button kind = "button" elegance = "btn btn-information dropdown-toggle" 
               data-toggle = "dropdown" aria-haspopup = "actual" aria-accelerated = "false">
               
               Dividers Example
            </button>
            <div elegance = "dropdown-menu">
               <a class = "dropdown-item" href = "#">Home</a>
               <a magnificence = "dropdown-item" href = "#">About Us</a>
               <div class = "dropdown-divider"></div>
               <a elegance = "dropdown-object" href = "#">Contact Us</a>  
            </div>
         </div>
         <br>
         <br>
         
         <h2>Text</h2>
         <div magnificence = "dropdown">
            <button kind = "button" magnificence = "btn btn-data dropdown-toggle" information-toggle = "dropdown">
               Dropdown button
            </button>
            <div class = "dropdown-menu">
               <a class = "dropdown-item" href = "#">Home</a>
               <a magnificence = "dropdown-object" href = "#">About Us</a>
               <a magnificence = "dropdown-item-text" href = "#">This is Text Link</a>
               <span magnificence = "dropdown-item-textual content" href = "#">Thi is just Text</span>
            </div>
         </div>
      </div>
      
      <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
      <script src = "https://code.Jquery.Com/jquery-3.3.1.Narrow.Min.Js" 
         integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
         crossorigin = "anonymous">
      </script>
      
      <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js" 
         integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" 
         crossorigin = "anonymous">
      </script>
      
      <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/js/bootstrap.Min.Js" 
         integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" 
         crossorigin = "nameless">
      </script>
      
   </frame>
</html>