CSS: Contextual Selectors |
| 'Contextual Selectors consist of several simple selectors separated by whitespace' (W3C: http://www.w3.org/pub/WWW/TR/REC-CSS1). Let's see: <style type="text/css> What's happen now? Take a look here: <h1>This is a line black</h1> Ok, but I want black lines...I want ONLY text within <em> tags to turn red! So, how you can see, ALL lines which contain <em> tags will be red. To avoid this problem, you can use contextual selectors. So, in the above example, you could have written: h1 em { color : red } In fact, in this way, only text within <em> tags (within <h1> tags) will turn red: <h1>This is a <em>simple</em>line to show you contextual selectors...</h1> |
Index Home Back About Contact us!
Copyright (c) 1998-2006 Wowarea