I try to set background color to ngb-pagination item for angular2, but is does not work.
<ngb-pagination style="background-color:gray;" [collectionSize]="120" [(page)]="page" [maxSize]="5" [boundaryLinks]="true">
Thank you.
For, removing the (current), maybe you can add a CSS style of display: none or visibility: hidden for that element.
Pagination is a component that only displays page numbers. It will not manipulate your data collection. You will have to split your data collection into pages yourself.
I don't if this library provide a way to customize the theme, if there that will be the best way.
But if you want to override some of the component inner styles you can use ::ng-deep
.
ngb-pagination ::ng-deep ul > li:not(.active) > a {
background-color: red !important;
}
ngb-pagination ::ng-deep ul > li.active > a {
background-color: lightgreen !important;
}
Also style="background-color:gray;"
will definitely not work, you can see the DOM and it's style
A little late to the party, but I got it to work in Angular 8 by adding the following code to my css file:
ngb-pagination ::ng-deep a {
color: black !important;
}
ngb-pagination ::ng-deep .page-item.active .page-link {
border-color: black;
background-color: lightgrey;
}
ngb-pagination ::ng-deep .page-item.active .page-link:focus, .page-link:not(:disabled):not(.disabled):active:focus {
box-shadow: 0 0 0 0.1rem dimgrey;
}
ngb-pagination ::ng-deep .page-link:not(:disabled):not(.disabled):active:focus {
box-shadow: 0 0 0 0.1rem dimgrey;
}
I found the solution, thank for helping. In my condition problem solved like that in my css file. To overwrite the pagination stuff just using /deep/
keyword.
/deep/ .pagination .page-item .page-link {
border-radius: 0 !important;
}
/deep/ .pagination .page-link {
border-top-style: none !important;
border-bottom-style: none !important;
background-color: #f6f6f6 !important;
color: black !important;
}
Thank you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With