SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    difference between child & descendant?

    Hi there,
    just wondering if someone can tell me the difference
    between one that is set as a child element, and one that is a descendant....How would their usage differ in a practical sense.....

    #whatever>p {padding:0px;} and
    #whatever p {padding:0px;}

    thanks

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not entirely sure on this, but to my understanding, the difference is thus:

    A child must be only one level deeper than its parent. So, in "<div><p><b>hello</b></p></div>", B is a child of P, and P is a child of DIV, but B is not a child of DIV.

    A descendant, on the other hand, can be a child, or a child's child, ad infinitum. Thus, in the previous example, both B and P are descendants of DIV.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •