Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    http://www.w3.org/TR/selectors/#gene...ng-combinators

    Only <p>Line Three</p> should be selected. It's for siblings, not children.

    You're probably looking for child combinator or descendant combinator.
    Reza O likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    Quote Originally Posted by Ronald Roe, post: 244209
    http://www.w3.org/TR/selectors/#gene...ng-combinators

    Only <p>Line Three</p> should be selected. It's for siblings, not children.

    You're probably looking for child combinator or descendant combinator.
    But why doesn't it consider the first div at all? It goes to the sibling for the second div. Ignoring the first div. Thanks in advance for your help.

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    It doesn't consider the first div because it's the parent. If you want to select the paragraphs within that first div, you need to use the child or descendant combinator.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    Quote Originally Posted by Ronald Roe, post: 244243
    It doesn't consider the first div because it's the parent. If you want to select the paragraphs within that first div, you need to use the child or descendant combinator.
    So how come it considers the first P?

  7. #6
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    Anyone?

  8. #7
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Dude, I've answered your question twice, as well as posted links to the answer. You're using a sibling combinator. It will only select elements at the same level. Since the first div tag is only an opening tag, thus making it the parent element, it has no siblings. There's really no way to break this down and spoon feed it any better.
    AlphaMare likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  9. #8
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    But how come the first p is considered? Sorry if I'm being dense here.

  10. #9
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    Quote Originally Posted by Reza O, post: 244862
    But how come the first p is considered? Sorry if I'm being dense here.
    Doesn't it mean any p that comes after the first p. And every p that comes after a div.

  11. #10
    Member Reza O's Avatar
    Join Date
    Nov 2012
    Posts
    53
    Member #
    33634
    Liked
    1 times
    I think I get it..Correct me if I am wrong. The first div tag has an opening and closing bracket that encompasses the whole code so it's the parent. The second div tag opens and closes before the p tag at the end hence they are siblings. Am I right?
    Ronald Roe likes this.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:18 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com