I was browsing the Selectutorial, when I came across the Child selector. I always use:
div p { color: blue; }
to target any p within a div, but the selectutorial uses:
div > p { color: blue; }
Is there a difference?
Also, I learnt about a way of selecting elements that I've never heard of: the adjacent selector:
h2 + h3 { color: blue; }
This would target any h3 that follows an h2 in the code. I can't really see any advantage to this... but I found it interesting nevertheless!
Later on...
Wow!!! Reading further, I came across the attribute selector! For example, you could select an image where the src is "small.gif" by using the following css:
img[src="small.gif"] { border: 1px solid #000000 }
It also uses the example: if you want to select any img with an "alt" tag regardless of what it is:
img[alt] { border: 1px solid #000000 }
This time I'm going to quote: The example below will select any image whose attribute (in this case "alt") contains a space separated list of words - in this case any "alt" that includes the word "small".
img[alt~="small"] { border: 1px solid #000000 }
Again, a quote: The example below will select any image whose attribute (in this case "title") has a hyphen separated list - in this case any title that includes "small-".
img[title|="small"] { border: 1px solid #000000 }
Apparently the attribute selector is not supported by any current versions of IE, sadly.


Help


MultiQuote














