{"id":14279,"date":"2011-09-06T20:34:31","date_gmt":"2011-09-07T03:34:31","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14279"},"modified":"2013-03-25T13:31:07","modified_gmt":"2013-03-25T20:31:07","slug":"universal","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/u\/universal\/","title":{"rendered":"Universal"},"content":{"rendered":"

The Universal Selector<\/code> is the * in CSS. Literally the asterisk character. It is essentially a type selector<\/a> that matches any type. Type meaning an HTML tag like <div><\/code>, <body><\/code>, <button><\/code>, or literally any of the others.<\/p>\n

A common use is in the universal reset, like this:<\/p>\n

* {\r\n  margin: 0;\r\n  padding: 0;\r\n}<\/code><\/pre>\n

There are times when using the universal selector is implied. For instance:<\/p>\n

*.module {  }<\/code><\/pre>\n

is exactly the same as:<\/p>\n

.module {  }<\/code><\/pre>\n

And in fact, the specificity<\/a> of those is exactly the same, as the universal selector hold no specificity value at all.<\/p>\n

The universal selector also is used with “universal namespaces”. It’s a bit weird, so I’ll just let this simple demo<\/a> speak for itself.<\/p>\n

Other Resources<\/h3>\n