Support Forum

  • Page:
  • 1

CSS Specificity

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

CSS specificity is a vital concept that any developer needs to be aware of when writing CSS code - in a nutshell specificity determines, which CSS rule takes precedence and is then applied.

Each individual selector has a fixed value with adds up to a value and determines what is displayed
e.g. If two selectors apply to the same element, the one with higher specificity wins.

p {color:#000;}
body p {color:#fff;}

So in this case body p would render as its more specific and the paragraph font colour would be white. This is a simple example and there are several factors involved with specificity ( included the order of css, classes, ids etc )

Check out - coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/ for more information
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers