CSS Selectors
The fundamental of working with the Document object Model is to understand Selectors and how to "select" them.
My code uses many selection methods and I am analysing them as I dissect my code. I admit that I was a little confused when I came across the Univeral Selector. The querySelectorAll()
What W3C say:
The Universal Selector
The following is the W3C example that makes all elements centre on screen and have the colour blue.
a Universal Selector:
<style>
* {
text-align: center;
color: blue;
}
</style>
Earlier fixes for legacy browsers
Looking back on some of the code that I was copying and trying to understand from 2011. In this case a cascading menu I found on the A List Apart website.
An example of the usage of a Universal Selector:
/* Fix IE. Hide from IE Mac \ Need to look this up on A List Apart*/
* html ul li { float: left; }
* html ul li a { height: 1%; }
/* End */
This an example of the Universal Selector. The "fix" is not now just for IE (which I hope everyone is now using a version that complies to the current standards!). The float on the ul li and the height for the ul li hyperlink tag are probably not really noticable
Having said that, the comment in the code is not particularly helpful or clear and I am not sure if the CSS "hides" are "fixes" what it claims.
The Universal Selector, * , is not obvious if you are not familiar with the CSS.