| Cascading StyleSheet Information, pg. 4 | ||
|---|---|---|
|
The HTML/XHTML Document Tree Webpages have family trees just like people. Elements can have children, who have children, and so on. The tree that you create in your webpage will determine how you select things to style. Example of a basic webpage: (only the body) <body> <div id="container"> <div id="heading">This is my website!</div> <div id="navigation"> <a href="page1.html">link #1</a> <a href="page2.html">link #2</a> <a href="page3.html">link #3</a> </div> <div id="content"><p><span>Welcome!</span> This is my page content.</p></div> <div id="footer">©2007 by Wendy Webby</div> </div> </body> The example's document tree: ![]() |
Selectors In order to use CSS properties you have to use selectors. These are usually just HTML tags without the angle brackets. Sometimes the HTML tag selectors aren't enough if you have a particular tag on a webpage multiple times and only want to style a few instances of it. This is where IDs and classes come in. Within HTML tags, the "id" or "class" attributes are used. Sometimes it's necessary to use both at once. Within the stylesheet (embedded or external), # (id) or . (class) are used instead. The <span> tag is a special HTML tag whose sole purpose is to transmit styles to text. Only properties that affect the inline model and the box model's padding property will work on it. Selectors that Internet Explorer interprets correctly:
|
|