Selector for one tag directly followed by another tag

后端 未结 4 1147
死守一世寂寞
死守一世寂寞 2020-12-30 18:18

This selects all tags directly preceded by tags:

A+B {
    /* styling */
}

What is t

4条回答
  •  醉酒成梦
    2020-12-30 19:00

    Do you mean to style A given that it has a B element directly inside or followed? Like this:

    
        
        
    
    
    // OR
    
    
    
    
    
    

    You can't do such a thing in CSS (yet). Eric Meyer states that this kind of selector has been discussed quite a few times on the CSS mailing list, and isn’t doable. Dave Hyatt, one of the core WebKit developers, comments with a good explanation of why it can’t be done.

    Check out: Shaun Inman's blog post and the comment by Eric Meyer.
    David Hyatt weighs in, too.

提交回复
热议问题