【问题标题】:How to center ngb-pagination in angular4?如何在angular4中将ngb-pagination居中?
【发布时间】:2019-01-17 19:10:34
【问题描述】:
<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,上面的代码没有将分页组件居中。有没有办法让它居中?感谢您的帮助。

【问题讨论】:

    标签: angular ng-bootstrap


    【解决方案1】:

    试试这样:

    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;
    }
    

    【讨论】:

      【解决方案2】:

      现在有了 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>

      【讨论】:

        猜你喜欢
        • 2017-10-29
        • 1970-01-01
        • 2020-05-31
        • 1970-01-01
        • 2023-01-12
        • 2021-12-12
        • 2020-09-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多