We help IT Professionals succeed at work.

How to stop a style being overridden by another style

alex_wareing
alex_wareing asked
on
290 Views
Last Modified: 2013-11-05
I know this problem has to do with the order of selection but i'm not quite sure what the rigt way to do this is. Here is my HTML:
<p class="paging"><a href="#">&laquo;</a>&nbsp;<a href="#">1</a>&nbsp;<a href="#" id="pagingSelected">2</a>&nbsp;<a href="#">3</a>&nbsp;<a href="#">4</a>&nbsp;<a href="#">5</a>&nbsp;<a href="#">6</a>&nbsp;<a href="#">7</a>&nbsp;<a href="#">&raquo;</a></p>

And my CSS:
.paging a {
      border:1px solid #CCCCCC;
      padding:1px 5px 1px 5px;
      color:#666666;
}
.paging a:hover {
      text-decoration:none;
      border:1px solid #000000;
}
.pagingSelected {
      background-color:#006600;
}

The problem i'm having is getting the .pagingSelected style to work. What am i doing wrong. I tried selecting using the following:
.pagingSelected
a.pagingSelected
.paging .pagingSelected
.paging a.pagingSelected

None seemed to work, where am i going wrong?
Comment
Watch Question

CERTIFIED EXPERT
Expert of the Year 2004
Top Expert 2004

Commented:
why id.....you should use class instead of that....liek this;

<a href="#" class="pagingSelected">2

Author

Commented:
Ok that was a bit of a basic error! I have changed it to class but this still doesn't let me change things like border or text color.
CERTIFIED EXPERT
Expert of the Year 2004
Top Expert 2004
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Use id:

#pagingSelected {
      background-color:#006600;
                  border:2px solid #000;
                  color:#CCCCCC
}

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.