Tutorialspoint examples

Learn java tutorial with examples for beginners online

Bootstrap Nesting Button Groups & Dropdown Menus


We have to nest button groups to create dropdown menus.

Bootstrap Nesting Button Groups Example:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Nesting Button Groups Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
 
<div class="container">
  <h2>Bootstrap Nesting Button Groups Example</h2>
  <div class="btn-group">
    <button type="button" class="btn btn-primary">Apple</button>
    <button type="button" class="btn btn-primary">Samsung</button>
    <div class="btn-group">
      <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
      Sony <span class="caret"></span></button>
      <ul class="dropdown-menu" role="menu">
        <li><a href="#">Tablet</a></li>
        <li><a href="#">Smartphone</a></li>
      </ul>
    </div>
  </div>
</div>
 
</body>
</html>

Try it:

Bootstrap Nesting Button Groups Example on jsbin.com

Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status