www.webdeveloper.com
Results 1 to 4 of 4

Thread: css syntax : what is + ?

  1. #1
    Join Date
    Apr 2005
    Posts
    210

    Arrow css syntax : what is + ?

    I saw css code somewhere with '+', I can't remember exact format.
    i.e.
    Code:
    .... #first + #second ...
    {
       ...
    }
    What does the '+' mean in css?
    How many ways to use it?

    i.e. (maybe incorrect in format)
    Code:
    #first + #second > div
    {  
       ...
    }
    or
    Code:
    #start > #first + #second
    {  
       ...
    }
    or more? or else?

    Thanks.
    .

  2. #2
    Join Date
    May 2012
    Posts
    6
    + is a sibling selector. they must have the same parent.

    example:

    p + p { color: #F00 }

    <div>
    <p>first paragraph</p>
    <p>second paragraph</p>
    </div>


    the style will affect only in the second paragraph

  3. #3
    Join Date
    Mar 2012
    Posts
    48
    ul + p {
    color: red;
    }
    will color the first paragraph after the ul.

    #container > ul {
    color: red;
    }
    will color all the first generation 'ul's inside the id 'container'

    for more useful css selectors such as
    a[href*="tuts"] { color: #00ff00; }
    check our this

  4. #4
    Join Date
    Apr 2005
    Posts
    210
    Thanks for all of above.

    I thought '+' is 'and' before.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles