Style Sheets
  Home arrow Style Sheets arrow Learn CSS, Selectors, Part 3
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Learn CSS, Selectors, Part 3
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2005-06-20

    Table of Contents:
  • Learn CSS, Selectors, Part 3
  • The Descendant Selector
  • The Child Selector
  • Direct Adjacent Sibling Selector

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Learn CSS, Selectors, Part 3


    (Page 1 of 4 )

    This will be the last discussion about CSS selectors in this series. In this article we will discuss the descendant, child and sibling selectors, with numerous code examples. It is the sixth article in our series covering CSS.

    To understand structured CSS selectors, you need to understand how markup documents like HTML documents are structured. As you know, every HTML document begins with the element <HTML>. This is called the root element because it's the beginning of the HTML structured elements. To understand the HTML structure, let's take a look at the following HTML code:

    <html>
    <head> 
    <title>CSS Selectors</title>
    </head>
    <body>
        <a href="Home.html">Home</a>
        <p>You can use CSS with markup languages like HTML, XHTML and XML. All those markup languages and also CSS has Specifications as the <a href="http://www.w3.org">W3C website</a> 
        <span>The <strong>W3C</strong> is the organization of web standards </span></p>
    </body>
    </html>

    I have indented the code so the root <HTML> element can be seen. All of the elements under the <HTML> elements are descendants from it. Any element in the document has one ultimate ancestor which is the <HTML> element, and that's why we call it the root element. It's better to discuss it in the form of a parent-child relationship: the <HTML> has two child elements in this code, the <Head> element and the <Body> element, so they are the direct children of the parent <HTML>. The <Body> element has two child elements, which are the <a> and the <p> elements. Although the <p> and <a> are child elements of <Body>, we can say that they have the same ancestor (the <Body> element). You must be familiar with this structure, because I assume that you have some experience with XHTML and XML.

    More Style Sheets Articles
    More By Michael Youssef


       · Nice explanation of some tricky little aspects of style sheets. The example you...
     

    STYLE SHEETS ARTICLES

    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification
    - CSS: Dimensions
    - CSS: Margins and Padding
    - CSS: Crossing the Border
    - CSS: Text, Fonts, and Tables
    - CSS: Working with Text
    - CSS: Backgrounds
    - CSS for the Newbie







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway