0

I'm trying to make a website with the navigation layout from Material Design Lite and I want to put an icon with notifications in my navigation bar. So far I have something like this: http://codepen.io/anon/pen/qONOjP

<html>
  <head>
    <!-- Material Design Lite -->
    <script src="https://storage.googleapis.com/code.getmdl.io/1.0.4/material.min.js"></script>
    <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.4/material.indigo-pink.min.css">
    <!-- Material Design icon font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>
  <body>
    <!-- Always shows a header, even in smaller screens. -->
    <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
      <header class="mdl-layout__header">
        <div class="mdl-layout__header-row">
          <!-- Title -->
          <span class="mdl-layout-title">Title</span>
          <!-- Add spacer, to align navigation to the right -->
          <div class="mdl-layout-spacer"></div>
          <!-- Navigation. We hide it in small screens. -->
          <nav class="mdl-navigation mdl-layout--large-screen-only">
            <span id="notifica" data-badge="1" class="icon material-icons mdl-badge">account_box</span>
            <a class="mdl-navigation__link" href="">Link</a>
            <a class="mdl-navigation__link" href="">Link</a>
            <a class="mdl-navigation__link" href="">Link</a>
          </nav>
        </div>
      </header>
      <div class="mdl-layout__drawer">
        <span class="mdl-layout-title">Title</span>
        <nav class="mdl-navigation">
          <a class="mdl-navigation__link" href="">Link</a>
          <a class="mdl-navigation__link" href="">Link</a>
          <a class="mdl-navigation__link" href="">Link</a>
          <a class="mdl-navigation__link" href="">Link</a>
        </nav>
      </div>
      <main class="mdl-layout__content">
        <div class="page-content"><!-- Your content goes here --></div>
      </main>
    </div>
  </body>
</html>

The badge is a little too far from the account box icon. It's not like the badges in the mdl website: http://www.getmdl.io/components/index.html#badges-section

How can I fix this?

gesuwall
  • 587
  • 2
  • 5
  • 15

1 Answers1

2

http://codepen.io/anon/pen/YyWyYv

Add this rule:

.mdl-badge[data-badge]:after {right: -12px!important;}

!important shouldn't be necessary though. Make sure you add this rule after you've loaded Material Design Lite's CSS.

Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239