如何在Material设计中将按钮移动到容器的右侧

Ang*_*gel 4 material-design angular

我想要一个按钮移动到容器的右侧,我使用了几种形式,但我无法得到它,不知何故 style="float: right;"

也许这不是一件事,材料设计,我没有前端开发的经验.


在此输入图像描述

 <md-toolbar color="primary">
    <span><md-icon>mood</md-icon></span>

    <span>Material in Angular 2!</span>

    <button md-icon-button style="float: left;" [md-menu-trigger-for]="menu">
      <md-icon style="float: left;">more_vert</md-icon>
    </button>
  </md-toolbar>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

<button md-icon-button style="float: right;" [md-menu-trigger-for]="menu">
      <md-icon style="float: right;">more_vert</md-icon>
Run Code Online (Sandbox Code Playgroud)

我想把它移到这里.我很抱歉我的英语不好.我希望你能理解我.

在此输入图像描述

aar*_*ond 8

你错过了<span>允许它填充空间的文本类:

在此处查看完整示例.

.example-fill-remaining-space {
  // This fills the remaining space, by using flexbox. 
  // Every toolbar row uses a flexbox row layout.
  flex: 1 1 auto;
}
Run Code Online (Sandbox Code Playgroud)
<md-toolbar color="primary">
  <span>Application Title</span>

  <!-- This fills the remaining space of the current row -->
  <span class="example-fill-remaining-space"></span>

  <span>Right Aligned Text</span>
</md-toolbar>
Run Code Online (Sandbox Code Playgroud)