Question

There are six different types of selectors in CSS style rules: type selectors, universal selectors, ID selectors, class selectors, pseudo-class selectors, and descendant selectors. Identify and name the four different selectors used in the following style rules.

#a1, .important { font-style:italic } 
ol span { background-color:aqua } 
a:hover { color:green } 

I used this site for information. http://www.w3.org/TR/CSS21/selector.html#simple-selector

The only one i can guess is that #a1 is a universal selector?

Could someone please explain this to me? Or could you find me a website that does, i didn't find any sites useful and w3 isn't helping me either

Was it helpful?

Solution

W3 documentation is very verbose and difficult for a beginner, to interpret

try this: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started

specifically, to answer your question:

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors

OTHER TIPS

The first one is ID selector PLUS class selector for ID "a1" and class ".important". The second is descendant selector for all spans that are children of ol. The third is universal selector for all anchor tags on hover state.

#a1  - ID selector 
.important    - class selector
ol span  -  universal selector
a:hover - pseudo

Try this site for learning. It is very good for beginners.

http://www.codecademy.com/tracks/web

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top