【问题标题】:Center ngx-pagination中心 ngx 分页
【发布时间】:2022-01-14 04:40:53
【问题描述】:

我有一个 ngx 分页:

<pagination-controls
                  id="pagination"
                  (pageChange)="page = $event"
                  (pageBoundsCorrection)="page = $event"
                  [maxSize]="9"
                  [directionLinks]="true"
                  [autoHide]="true"
                  [responsive]="true"
                  previousLabel="Previous"
                  nextLabel="Next"
                  screenReaderPaginationLabel="Pagination"
                  screenReaderPageLabel="page"
                  screenReaderCurrentLabel="You're on page">
</pagination-controls>

中心的东西像:

<div class="d-flex justify-content-center">
  <my-pagination></my-pagination>
</div>

不起作用,因为分页的 width 始终是页面的 100% width

我怎样才能使分页的宽度尽可能小并保持负责?

【问题讨论】:

    标签: css angular center ngx-pagination


    【解决方案1】:

    CSS:

    .mat-paginator-container {
      width: fit-content !important;
    }
    

    如果你想让它在任何地方居中,也可以添加:

    .mat-paginator-outer-container {
      justify-content: center !important;
    }
    

    【讨论】:

      猜你喜欢
      • 2019-08-20
      • 2021-11-01
      • 2018-12-29
      • 2018-01-21
      • 2018-02-13
      • 2023-04-08
      • 2018-03-02
      • 2021-04-22
      • 2018-01-17
      相关资源
      最近更新 更多