首页 > 解决方案 > 如何使用边距自动 Css 角度 4 将跨度向左移动

问题描述

嗨,我有一些关于 Css 的问题,但我无法做到。 在此处输入图像描述

如何将那些突出显示的数字与名称一起向左移动。我已经尝试过 flex direction margin auto 等,但我无法得到想要的结果。

这是我的html代码

<section class="favorites">
<div class="category" *ngFor="let category of categoryKeys">
<div class="sub-header">{{category}}</div>
<app-custom-accordion [closeOthers]="true">
  <ngb-panel [disabled]="panel.Tests.length === 0" *ngFor="let panel of testSelectionSession.FavoritesByCategory[category]"
             id="{{panel.Id}}" [title] = "panel.Name">
    <ng-template ngbPanelTitle>
      <span class="test-length" style=""> {{ '(' + panel.Tests.length + ')'}}</span>
      <div class="action-items">
        <span class="icon-set" [ngClass]="{'same-day-2x': isSameDay(panel.Code), 'next-day-2x': isNextDay(panel.Code)}"></span>
        <label class="custom-control custom-checkbox">
          <input type="checkbox" class="custom-control-input" [name]="panel.Id + '-' + panel.Moniker" [ngModel]="checkAllTestsSelected(panel)"
            (ngModelChange)="onPanelCheckboxUpdate($event, panel)" [id]="panel.Id + '-' + panel.Moniker">
          <span class="custom-control-indicator"></span>
        </label>
      </div>
    </ng-template>
  </ngb-panel>
</app-custom-accordion>

我正在尝试将此标签移到左侧

<span class="test-length" style=""> {{ '(' + panel.Tests.length + ')'}}</span>

有人可以帮我解决这个问题吗?

标签: javascripthtmlcssangulartypescript

解决方案


最简单的解决方案将包括

'(' + panel.Tests.length + ')'

在面板标题中:

  <ngb-panel [disabled]="panel.Tests.length === 0" *ngFor="let panel of testSelectionSession.FavoritesByCategory[category]"
             id="{{panel.Id}}" [title] = "panel.Name + '(' + panel.Tests.length + ')'">

该组件非常像一个表格,使单独列的内容向左浮动似乎很难实现。虽然我不熟悉ngb-panel


推荐阅读