Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2009
    Location
    UK
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS Priority/Inheritance

    Hello,

    I have a WHMCS installation and am adding a header to it but have come across some issues. Ive figured out that the reason the header to not displaying correctly is because the header is using styles from the WHMCS theme and not the CSS files designed for it.

    My question is, how can I get the header to use the correct file? Is there a way to prioritise the files or stop Inheritance etc?

    The site is http://my.eximushosting.com - this is the WHMCS install with custom header.

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts
    You want to make sure your stylesheet comes after the other one when you write it in your document. Also, IDs have higher execution priority than classes. That means p#love styles will win out over p.hate. Specificity will also play a part, so if your element is not displaying the style you want, maybe it's because the other stylesheet has more specificity. For example, .container p.intro will have priority over p.intro, and #maincontent p.intro will have priority over .container p.intro. So check how each element is nested and you'll be able to track down your problem.

    I read in Eric Meyer's book that you should think of IDs as hundreds, classes as tens, and tags as ones. so #maincontent p is 101 while #maincontent p.funky is 110 and #maincontent .love p is 111.
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •