Search code examples
htmlcsstwitter-bootstrapbootstrap-material-design

Bootstrap material design dropdown button is not drawn correctly


I am trying to use button from bootstrap material design from below link: http://fezvrasta.github.io/bootstrap-material-design/bootstrap-elements.html

I downloaded the dropdown button and all needed CSS and JavaScript from the above link. When I am trying to test a sample dropdown button it is not drawn properly. Below is the sample html code and output.

I am not able to find out what I am missing. I tried to find the answers from net but didn't find any! So I am posting it here.

<html>

<head>
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
  <!-- Include roboto.css to use the Roboto web font, material.css to include the theme and ripples.css to style the ripple effect -->
  <link href="css/roboto.min.css" rel="stylesheet">
  <link href="css/material.min.css" rel="stylesheet">
  <link href="css/ripples.min.css" rel="stylesheet">
</head>

<body>

  <h3>Why this dropdown icon height is half of button????</h3>
  <div class="btn-group">
    <a href="javascript:void(0)" class="btn btn-primary">Primary</a>
    <a href="bootstrap-elements.html" data-target="#" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
    <ul class="dropdown-menu">
      <li><a href="javascript:void(0)">Action</a>
      </li>
      <li><a href="javascript:void(0)">Another action</a>
      </li>
      <li><a href="javascript:void(0)">Something else here</a>
      </li>
      <li class="divider"></li>
      <li><a href="javascript:void(0)">Separated link</a>
      </li>
    </ul>
  </div>

  <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

  <script src="js/ripples.min.js"></script>
  <script src="js/material.min.js"></script>
  <script>
    $(document).ready(function() {
      // This command is used to initialize some elements and make them work properly
      $.material.init();
    });
  </script>
</body>

</html>

enter image description here


Solution

  • Setting the doctype to HTML5 did the trick for me -- add <!doctype html> to the top of your document.

    I don't know why, but it's the FIRST thing I thought of.