I was just playing around with a css ul for a menu. My initial css of
#nav ul {...}
did not work, but
ul#nav {...}
worked. What’s the reason for this?
Another similar question is what is the difference between:
div.grey
OR
div .grey
Notice the space between the two…
#nav ullooks for anulelement within an element having the id of “nav”.ul#navlooks for aulthat has the id value of “nav”.The same goes for classnames:
div.greylooks for adivelement having the classname “grey”.Whereas
div .greylooks for any element having the classname “gey” within adiv.