Posts: 457
Name: Randy
Location: Northern Wisconsin
|
This is a method to target areas of your document using less id's and classes overall.
This method will "aim" for items nested within a certain id or class. Here is an example, let's say you wanted to style an anchor, but ONLY an anchor within a div with a class of "info":
<div class="info">
<p>hello</p>
<ul>
<li><a href="#">item 1</a></li> <!-- you want to style this anchor -->
</ul>
</div>
In your css you could target this anchor by:
.info ul li a {
/* this is styling that applies to the anchor above */
}
Do you see how I didn't have to create a special class for that anchor? Plus, in my css I can clearly see what area of the document I am styling. Very helpful for css that runs into hundreds of lines of code.
This is called using the DOM(document object model) you can visit http://www.w3schools.com/js/js_obj_htmldom.asp
Last edited by racer x; 05-15-2009 at 03:03 PM..
Reason: I had id for info in css oops
|