将”Ngx-Pagination”的默认蓝色更改为其他颜色。

huangapple go评论79阅读模式
英文:

Ngx-Pagination change default blue color to other color

问题

I am using ngx-pagination in my Angular 16 application and I want to customize the default blue color to another color. Can anyone help me?

Html code:

<div>
  <pagination-controls></pagination-controls>                       
</div>

CSS:

.ngx-pagination .current{
  color: #ffffff !important;
  background-color: red !important;
}

Tried with the above and similar CSS, but it does not work. Any help will be appreciated.

英文:

I am using ngx-pagination in Angular 16 application and I want to customize the default blue color into another , Can anyone help me.

将”Ngx-Pagination”的默认蓝色更改为其他颜色。

Html code:

&lt;div&gt;
  &lt;pagination-controls&gt;&lt;/pagination-controls&gt;                       
&lt;/div&gt;

CSS

.ngx-pagination .current{
  color: #ffffff !important;
  background-color: red !important;
}

Tried with above and similar css, it do not works.

Any help will be appreciated.

答案1

得分: 0

尝试这些更改:

/* 更改当前页面的背景颜色 */
.pagination-current {
  background-color: red !important;
}

/* 更改当前页面的文本颜色 */
.pagination-current a {
  color: #ffffff !important;
}

/* 更改页面按钮的背景颜色 */
.pagination-controls button {
  background-color: red !important;
}

如果不起作用,意味着我想进一步检查您的代码行。

英文:

Try these changes ,

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

/* Change the background color of the current page */
.pagination-current {
  background-color: red !important;
}

/* Change the text color of the current page */
.pagination-current a {
  color: #ffffff !important;
}

/* Change the background color of the page buttons */
.pagination-controls button {
  background-color: red !important;
}

<!-- end snippet -->

If it is not working means , I want to Inspect your line of code further more

答案2

得分: 0

以下是已翻译的内容:

HTML

&lt;pagination-controls class=&quot;my-pagination&quot;&gt;&lt;pagination-controls&gt;

CSS

.my-pagination ::ng-deep .ngx-pagination .current {
    background: red;
  }
英文:

It worked after below changes.

HTML

&lt;pagination-controls class=&quot;my-pagination&quot;&gt;&lt;pagination-controls&gt;

CSS

.my-pagination ::ng-deep .ngx-pagination .current {
    background: red;
  }

答案3

得分: 0

Your code is correct, and it should work. The only thing you need to ensure is that you place the CSS class correctly. It should not be at the component level where you are using ngx-pagination.

你的代码是正确的,它应该可以工作。唯一需要确保的是正确放置CSS类。它不应该在你使用ngx-pagination的组件级别。

You have two options for placing the CSS class correctly:

你有两种选项来正确放置CSS类:

Add the CSS class to the style.css file: You can add the following code to the style.css file in your Angular project:

将CSS类添加到style.css文件中:您可以将以下代码添加到您的Angular项目中的style.css文件中:

.ngx-pagination .current {
  color: #ffffff !important;
  background-color: red !important;
}

Or create a new file and import it into style.css like this.

或者创建一个新文件,并像这样将其导入到style.css中。

@import 'path/to/pagination-customization.css';

There is an official live demo with my changes in style.css, have a look, please.

有一个官方的在线演示,其中包含我在style.css中的更改,请查看:

https://angular-zgr18t.stackblitz.io

英文:

Your code is correct, and it should work. The only thing you need to ensure is that you place the CSS class correctly. It should not be at the component level where you are using ngx-pagination.

You have two options for placing the CSS class correctly:

Add the CSS class to the style.css file: You can add the following code to the style.css file in your Angular project:

.ngx-pagination .current {
  color: #ffffff !important;
  background-color: red !important;
}

Or create new file and import into style.css like this.

@import &#39;path/to/pagination-customization.css&#39;;

there is oficial live demo with my changes in style.css have a look pls.

https://angular-zgr18t.stackblitz.io

huangapple
  • 本文由 发表于 2023年5月25日 18:30:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76331306.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定