中心 ngx-分页
Center ngx-pagination
我有一个 ngx-pagination :
<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>
不起作用,因为分页的 宽度 始终是页面的 100% 宽度。
如何让分页的 width 尽可能小并保持它的责任感?
CSS:
.mat-paginator-container {
width: fit-content !important;
}
如果你想让它在任何地方都居中,也添加这个:
.mat-paginator-outer-container {
justify-content: center !important;
}
我有一个 ngx-pagination :
<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>
不起作用,因为分页的 宽度 始终是页面的 100% 宽度。
如何让分页的 width 尽可能小并保持它的责任感?
CSS:
.mat-paginator-container {
width: fit-content !important;
}
如果你想让它在任何地方都居中,也添加这个:
.mat-paginator-outer-container {
justify-content: center !important;
}