Skip to content

Instantly share code, notes, and snippets.

@myfonj
Created March 26, 2014 02:20
Show Gist options
  • Save myfonj/9775795 to your computer and use it in GitHub Desktop.
Save myfonj/9775795 to your computer and use it in GitHub Desktop.
CSS selector specificity test
/*
CSS selector specificity test
pass trough code and activate/deactivate comments to see it in action
*/
/* add or remove space after "*" → */
#Menu:not(#x):not(#x):after {
content:'#Menu:not(#x):not(#x) ' !important;
}
/* equals * /
#Menu#Menu#Menu:after {
content:'#Menu#Menu#Menu ' !important;
}
/* > */
#Menu:not(#XXX):after {
content:'#Menu:not(#XXX) ' !important;
}
/* equals * /
#Menu#Menu:after {
content:'#Menu#Menu ' !important;
}
/* > */
#Menu:not(.XXX):after {
content:'#Menu:not(.XXX) ' !important;
}
/* equals * /
#Menu.some:after {
content:'#menu.some' !important;
}
/* equals * /
#Menu[id]:after {
content:'#Menu[id]' !important;
}
/* > */
div#Menu:after {
content:'div#Menu' !important;
}
/* equals */
#Menu:not(XXX):after {
content:'#Menu:not(XXX)' !important;
}
/* > */
#Menu:after {
content:'#Menu' !important;
}
/* */
<div class="some" id="Menu"></div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment