Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: CSS Priority/Inheritance
09-20-2013, 12:18 AM #1
- Join Date
- Apr 2009
- Thanked 0 Times in 0 Posts
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
09-20-2013, 01:37 AM #2
- Join Date
- Aug 2002
- San Francisco
- 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