3

I am using AngularJS and Bootsrtrap in my code. I am using this library for pagination for tables in it. It says here that I can style it with bootstrap, and I wanted to change color of selected number to orange.

enter image description here

Class of that field is active in CSS, and I tried to override its style in my css, but nothing changed. I used this CSS:

.active {
    background-color: #FFC773;
}

Can anyone help me solve this?

2
  • I guess it is very difficult to help you using the info you've provided. At least create a working demo, so we can see your full code in action. Commented Oct 11, 2015 at 12:47
  • It is clear since it is referenced that pagination is using twitter bootstrap pagination. Commented Oct 11, 2015 at 12:59

3 Answers 3

4

Above given answers are absolutely correct but you should also define the CSS for other states like focus, active and hover:

.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover {
    background-color: orange;
    border-color: organge;
}

This is to avoid various other issues.

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, this one solved the problem i described below. Those other states were problem. Thanks!
@FarzadYZ you are right, border color is needed also, otherwise it will look odd. :-)
2

Do not use .active alone! That is not a proper reference to an active class in a large framework. Just be specific and use this snippet below:

.pagination > .active > a {
    background-color: orange;
    border-color: red;
}

2 Comments

It is ok when it is first rendered. But when I click other page it changes color to original blue color. Do you know what seems to be problem?
Can you provide a fiddle please?
2

Try with:

.pagination > .active > a,
.pagination > .active > a:hover,
.pagination > .active > a:visited {
    background-color: #FFC773;
}

See plunker

Adjust also border if you want to.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.