简体   繁体   English

中心 ngx 分页

[英]Center ngx-pagination

I have an ngx-pagination:我有一个 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>

Things with center like:中心的东西像:

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

are not working, cause the width of the pagination is alwayws 100% width of the page.不起作用,因为分页的宽度总是页面的 100%宽度

How can i make width of the pagination as small as possible and keep it responsible?我怎样才能使分页的宽度尽可能小并保持负责?

CSS: CSS:

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

And if you want to center it everywhere add this too:如果你想在任何地方居中添加这个:

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

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

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