首页 > 解决方案 > flexbox 没有采用正确的宽度 Angular

问题描述

我创建了一个弹性表,它没有向我显示正确的表,只有第一个表很好,其他表的宽度不同。我试图在课程计划中放入另一个 div,但随后没有在行中显示我。

您可以在下面找到代码。 这是目前的照片

<div class="planning-videx">
    <div class="name-block" *ngFor="let valueItem of showVI()">
      {{valueItem.name}}
      <div class="planned">
        {{actualCosts | moneyFormat}}
      </div>
      <div class="planned">
        {{plannedCosts | moneyFormat}}
      </div>
    </div>
  </div>

这是CSS

$row-background-color: white;
$row-height: 100%;
$content-height: 45px;
.planning-videx {
  @extend .vp-column;
  margin-left: 10px;
  overflow: auto;
  max-height: $row-height;
  .name-block {
    @extend %common-block;
    @include center(false, true);
    @include justify-content(space-between);
    height: 40px;
    margin-left: 1px;
    padding-left: 10px;
    div.planned {
      @extend %flexbox;
      @include center(false, true);
      border-left: solid thin $border-color;
      padding: 0 5px;
      width: 150px;
      height: 100%;
    }

  }
  .costs-block {
    @extend %common-block;
    @include center();
    @include justify-content(flex-end);
    margin-left: 10px;
    padding-right: 5px;
    width: 100px;
    flex-direction: row;
  }
}

%common-block {
  @extend .vp-row;
  background-color: $row-background-color;
  margin-top: 1px;
  margin-bottom: 1px;
  min-height: $content-height;
  border: solid thin $border-color;
  border-radius: 3px;
}

标签: htmlcssangularflexbox

解决方案


我会为货币类别设置一个弹性基础或设置宽度,然后为标题设置一个“弹性:1”,以便它可以增长到剩余空间。


推荐阅读