Skip to content

The Worlds Quickest CSS Summary

I can’t quite natively read CSS yet, so I put this little table to help me remember how CSS rules target nodes.

Tag Means Target …
H1 All instances of the specified tag (h1)
.classname Anything where the classname attribute is set to classname
#myid Anything with an ID of myid
Div p All instances of a p tag under a div tag
Div.myclass p All instance of a p tag under a div tag where the div tag has a class name of myclass
Div.myclass, #foo All div tags with a class of myclass *AND* all tags which have an ID of foo

 

The other thing to remember is that if the same definition occurs multiple times or a node is targeted by multiple rules … the last one always wins.

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: