CSS p+p

Discussion in 'CSS' started by fadetoblack22, Aug 6, 2009.

  1. #1
    Is p+p {} valid css? I have it in the css of a wordpress theme. When I took it out there was a change in the way paragraphs were displayed.
     
    fadetoblack22, Aug 6, 2009 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    Yes. It's an adjacent sibling selector. It was always available in the modern browsers but only worked in IE when v8 came out.
     
    drhowarddrfine, Aug 6, 2009 IP
  3. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Ah, I think it was used to stop padding on the first p.
     
    fadetoblack22, Aug 6, 2009 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    Impossible. The values would only affect the second one.
     
    drhowarddrfine, Aug 6, 2009 IP
  5. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #5
    What I mean is a padding value was given and it only appears on the 2nd 3rd etc... <p> tags, so it doesn't appear on the first one.
     
    fadetoblack22, Aug 7, 2009 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    fadetoblack, this will not work in IE6 (if you care) and it's also a little bit brittle, since what if you do add some other, non-p element between some p's? The CSS would stop at that point, as then the p following the non-p element is in the same situation as the other "first p".
     
    Stomme poes, Aug 7, 2009 IP
  7. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #7
    Ok, thanks. Yeh, about 10% of my visitors still use IE6.
     
    fadetoblack22, Aug 7, 2009 IP