2

From getmdl.io/components/index.html#layout-section

I opened link to

https://codepen.io/anon/pen/MEoBqG

When I saved html code and opened it in few browsers locally. I see that menu button is mispositioned.

<html>
  <head>
    <!-- Material Design Lite -->
    <script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
    <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
    <!-- Material Design icon font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>
  <body>
    <!-- Simple header with scrollable tabs. -->
    <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>
        </div>
        <!-- Tabs -->
        <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
          <a href="#scroll-tab-1" class="mdl-layout__tab is-active">Tab 1</a>
          <a href="#scroll-tab-2" class="mdl-layout__tab">Tab 2</a>
          <a href="#scroll-tab-3" class="mdl-layout__tab">Tab 3</a>
          <a href="#scroll-tab-4" class="mdl-layout__tab">Tab 4</a>
          <a href="#scroll-tab-5" class="mdl-layout__tab">Tab 5</a>
          <a href="#scroll-tab-6" class="mdl-layout__tab">Tab 6</a>
        </div>
      </header>
      <div class="mdl-layout__drawer">
        <span class="mdl-layout-title">Title</span>
      </div>
      <main class="mdl-layout__content">
        <section class="mdl-layout__tab-panel is-active" id="scroll-tab-1">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
        <section class="mdl-layout__tab-panel" id="scroll-tab-2">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
        <section class="mdl-layout__tab-panel" id="scroll-tab-3">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
        <section class="mdl-layout__tab-panel" id="scroll-tab-4">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
        <section class="mdl-layout__tab-panel" id="scroll-tab-5">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
        <section class="mdl-layout__tab-panel" id="scroll-tab-6">
          <div class="page-content"><!-- Your content goes here --></div>
        </section>
      </main>
    </div>
  </body>
</html>

How I can fix the misposition of menu icon? Why it looks good on codepen but not locally?

screenshot with mispositioned icon

lllll
  • 37
  • 1
  • 5
  • That's terribly weird... like chrome is treating line-height differently in these two scenarios. Can't figure out what's wrong. As long as it stays ok on your web page, you are good. Otherwise, play with line-height of your (burger icon) node to center the icon. – adrian.krzysztofek Oct 01 '17 at 17:27

1 Answers1

3

The only difference between Codepen code and your code is the the missing <!DOCTYPE html>. At first, you might wonder, so what? sure the browser can handle it, right?. The truth is that, omitting <!DOCTYPE html> forces your browser to render your page in Quirks Mode.

So, what can go wrong in quirks mode? A lot of things can go wrong in quirks mode. I suspect that flexbox does not work as intended in your case (I will look into it and come back later).

Some useful info:

Kostas Siabanis
  • 2,989
  • 2
  • 20
  • 22