5

我想移动右上角的菜单图标按钮。但它出现在标题下。我应该添加什么样的属性或属性?

    <!-- Simple header with fixed tabs. -->
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header
            mdl-layout--fixed-tabs">
  <header class="mdl-layout__header">
    <div class="mdl-layout__header-row">
      <!-- Title -->
      <span class="mdl-layout-title">Title</span>
    </div>
    <!-- Right aligned menu below button -->

<button id="demo-menu-lower-right"
        class="mdl-button mdl-js-button mdl-button--icon">
  <i class="material-icons">more_vert</i>
</button>

<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
    for="demo-menu-lower-right">
  <li class="mdl-menu__item">Some Action</li>
  <li class="mdl-menu__item">Another Action</li>
  <li disabled class="mdl-menu__item">Disabled Action</li>
  <li class="mdl-menu__item">Yet Another Action</li>
</ul>
    <!-- Tabs -->
    <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
      <a href="#fixed-tab-1" class="mdl-layout__tab is-active">Tab 1</a>
      <a href="#fixed-tab-2" class="mdl-layout__tab">Tab 2</a>
      <a href="#fixed-tab-3" class="mdl-layout__tab">Tab 3</a>
      <a href="#fixed-tab-4" class="mdl-layout__tab">Tab 4</a>
    </div>
  </header>

这是一个图片网址

4

2 回答 2

1
  <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header
        mdl-layout--fixed-tabs">
       <header class="mdl-layout__header">
          <div class="mdl-layout__header-row">
              <div class="row" style="margin:0">
                 <!-- Title -->
                  <span class="mdl-layout-title left">Title</span>

                 <!-- Right aligned menu below button -->

                 <button id="demo-menu-lower-right" class="mdl-button mdl-js-button mdl-button--icon right">
                   <i class="material-icons">more_vert</i>
                 </button>
               </div>
           </div>
           <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="demo-menu-lower-right">
              <li class="mdl-menu__item">Some Action</li>
                 <li class="mdl-menu__item">Another Action</li>
               <li disabled class="mdl-menu__item">Disabled Action</li>
              <li class="mdl-menu__item">Yet Another Action</li>
           </ul>
            <!-- Tabs -->
             <div class="mdl-layout__tab-bar mdl-js-ripple-effect">
              <a href="#fixed-tab-1" class="mdl-layout__tab is-active">Tab 1</a>
              <a href="#fixed-tab-2" class="mdl-layout__tab">Tab 2</a>
               <a href="#fixed-tab-3" class="mdl-layout__tab">Tab 3</a>
              <a href="#fixed-tab-4" class="mdl-layout__tab">Tab 4</a>
              </div>
            </header>

我已经编辑了你给定的代码。希望这会有所帮助

于 2015-08-28T05:53:42.893 回答
1

要使菜单出现在右侧,您需要div在元素内添加以下mdl-layout__header-row内容,然后在头部右侧添加您想要的任何元素。有关详细信息,请参阅布局上的 Material Design Lite。

<div class="mdl-layout mdl-js-layout">
  <header class="mdl-layout__header mdl-layout__header--transparent">
    <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 -->
      <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>

      <!-- Right Menu -->
      <button id="demo-menu-lower-right"
              class="mdl-button mdl-js-button mdl-button--icon">
        <i class="material-icons">more_vert</i>
      </button>

      <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
          for="demo-menu-lower-right">
        <li class="mdl-menu__item">Some Action</li>
        <li class="mdl-menu__item">Another Action</li>
        <li disabled class="mdl-menu__item">Disabled Action</li>
        <li class="mdl-menu__item">Yet Another Action</li>
      </ul><!--/Right Menu -->
    </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">
  </main>
</div>

另外,如果你想改变Menu的位置,你可以改变mdl-menu--bottom-right到你喜欢的方向。请参阅页面底部的MDL菜单规范。

于 2015-08-29T21:49:34.067 回答