如何在 angular4 中居中 ngb-pagination?

How to center ngb-pagination in angular4?

<div class="col-12 text-center">
  <ngb-pagination [collectionSize]="120" [(page)]="pageNumber" 
   [maxSize]="5" [rotate]="true" [boundaryLinks]="true" size="lg">
  </ngb-pagination>
</div>

我正在为我的项目使用 ng-bootstrap 和 angular 4,上面的代码没有将分页组件居中。有没有办法使它居中?感谢您的帮助。

这样试试:

template.html

<div class="col-12 justify-content-center">
  <ngb-pagination [collectionSize]="120" [(page)]="pageNumber" 
   [maxSize]="5" [rotate]="true" [boundaryLinks]="true" size="lg">
  </ngb-pagination>
</div>

style.css

.justify-content-center {
    display: flex !important;
    justify-content: center !important;
}

现在 bootstrap 4 你可以只使用 bootstrap 类

<div class="d-flex justify-content-center">
  <ngb-pagination [collectionSize]="120" [(page)]="pageNumber" 
   [maxSize]="5" [rotate]="true" [boundaryLinks]="true" size="lg">
  </ngb-pagination>
</div>