CSS Selector Precedence
I'm a total disaster at remembering things. When I was 14, I already saw it coming, and started studying Frances Yates' "The Art of Memory". It didn't really help; by now I already forgot most of what it said.
Let me be a little bit more precise. I am able to remember a lot of things. But just for a very short time span. Like: weeks, at most.
So I need tools to force myself to remember some things forever. Or use Google continuously. (I'm really good at using Google.)
Anyway, one of the things that I just cannot remember is CSS precedence rules. So I wondered if I could create some mnemonics of these rules. This is my first stab at it. These are the rules in order of precedence:
- ! important
- S style attribute
- I id selector
- C class selector
- E element selector
- U universal selector
"!SICEU" doesn't mean anything in English as far as I know, but what about:
Bam! Sice you
It turns out that sice is actually a word. According to my dictionary, it means "the six on a dice". So I picture myself a medieaval London gambler yelling this at his opponent when he just roled the dice and won the game. If now I can only remember the mnemonic - and even more important, it's meaning...
I'm sure you can come up with something better. Are you using mnemonics to remember things? I would love to hear about them.