Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make icon move to the left on MDL header?

I tried setting the margin,padding to move the back-arrow icon to the left of the header but failed. How should I make this correct?

<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
 <header class="mdl-layout__header">
  <div class="mdl-layout__header-row">
      <!--back arrow-->
      <button class="mdl-button mdl-js-button mdl-button--icon" onclick="history.go(-1);">
       <i class="material-icons">arrow_back</i>
      </button>

     <!--Title-->
     <span class="mdl-layout-title">Settings</span>
  </div>

 <!-- Tabs -->
 <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
  <a href="{{pathFor route='home'}}" class="mdl-layout__tab">Profile</a>
  <a href="{{pathFor route='settings'}}" class="mdl-layout__tab">Account</a>
</div>

like image 835
sammkj Avatar asked Jul 11 '15 23:07

sammkj


2 Answers

I had the same problem with the back button. There is no visual demo in the docs, but reading the documentation I found the right way of doing so: just put a class mdl-layout-icon on your button.

<header class="mdl-layout__header">
  <button class="mdl-layout-icon mdl-button mdl-js-button mdl-button--icon" onclick="history.go(-1);">
    <i class="material-icons">arrow_back</i>
  </button>    
  <div class="mdl-layout__header-row">
    <span class="mdl-layout-title">Some title</span>
    <div class="mdl-layout-spacer"></div>
  </div>
</header>
like image 184
val Avatar answered Oct 21 '22 10:10

val


Try to use class 'mdl-layout__drawer-button' like this:

<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
  <header class="mdl-layout__header">
    <div class="mdl-layout__drawer-button"><i class="material-icons">arrow_back</i></div>
    <div class="mdl-layout__header-row">
      <span class="mdl-layout-title">Title</span>
    </div>
  </header>
  <main class="mdl-layout__content">
    <div class="page-content">
       Content
    </div>
  </main>
</div>
like image 4
anneb Avatar answered Oct 21 '22 08:10

anneb