繁体   English   中英

如何使用FlexLayout,Angular 4,材质设计来增加一个组件的高度

[英]How to increase height of one component using FlexLayout, Angular 4, Material Design

我想在两行之间出空隙,例如plunkr中所示,但我也希望中间的蓝色单元格在第一行的高度不同。

当我更改一个单元格的高度时,它将更改整行。 我大一点的是class="two"

我有这个HTML:

<md-card class="card-demo">
  <md-card-title>another example</md-card-title>
  <md-card-subtitle>some test work.
  </md-card-subtitle>
  <md-card-content>
    <div fxLayout="column" ng-app="demoApp" layout-fill>
      <div fxLayout="row" fxLayoutGap="20px" flex>
        <div class="one" fxFlex="70"> test1 </div>
        <div class="two" fxFlex="25"> test2 </div>
        <div class="three" fxFlex="25"> test2 </div>
      </div>
      <div fxLayout="column" fxLayoutGap flex>
        <div class="four" fxFlex="150"> test1
          <p>one</p>
          <p>one</p>
        </div>
      </div>
    </div>
  </md-card-content>
</md-card>

而这个CSS:

.one {
    background-color: red;
}

.two {
    background-color: blue;
}

.three {
    background-color: green;
}
.four {
    background-color: yellow;
}

您可以添加fxLayoutAlign更改默认的flex行为

  <div fxLayout="row" fxLayoutGap="20px" flex fxLayoutAlign="stretch flex-start">
    <div class="one" fxFlex="70"> test1 </div>
    <div class="two" fxFlex="25"> test2 </div>
    <div class="three" fxFlex="25"> test2 </div>
  </div>

https://stackblitz.com/edit/angular-pmborb?embed=1&file=app/app.module.ts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM