Obsession
Watching
You're Beautiful
Liar Game 2
Autumn's Concerto
Playing
World of Warcraft
WOW Character
Nick: Wishix
Lv: 80
Race: Blood Elf
Class: Priest
Guild: Intoxicated
Server: Thaurissan
Nick:Wishie
Lv: 80
Race: Undead
Class: Dark Knight
Guild: Singabombz
Server: Thaurissan
p { color: red; } p { color: blue; }p elements would be coloured blue because that rule came last. However, you won't usually have identical selectors with conflicting declarations on purpose (because there's not much point). Conflicts quite legitimately come up, however, when you have nested selectors. In the following example:
div p { color: red; } p { color: blue; }
It might seem that p elements within a div element would be coloured blue, seeing as a rule to colour p elements blue comes last, but they would actually be coloured red due to the specificity of the first selector. Basically, the more specific a selector, the more preference it will be given when it comes to conflicting styles.
The actual specificity of a group of nested selectors takes some calculating. Basically, you give every id selector ("#whatever") a value of 100, every class selector (".whatever") a value of 10 and every HTML selector ("whatever") a value of 1. Then you add them all up and hey presto, you have the specificity value.