Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Approximative sibling

    • 0
    • 3
    • 3
    • 1
    • 0
    • 0
    • 0
    • 0
    • 296
    Comment on it

    Hi all,

    The approximative sibling or adjacent sibling combines two selectors. + works as combinator.

    For example:

    p {color : green;}
    p + p { color:red;}
    

    HTML:-

    <div>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
        <span>THIS IS A SPAN </span>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
        <div>THIS IS A DIV</div>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
    </div>
    

    Out put :-

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    THIS IS A SPAN

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    THIS IS A DIV

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

    Now we can see some p tags output are green and some are red. Which paragraph tag that is directly (no any element in between) after another paragraph tag that are red and other are green.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: