Get siblings between 2 elements

后端 未结 4 421
旧时难觅i
旧时难觅i 2021-01-11 17:01

How can I get the elements between 2 other elements?

Like if I had:

4条回答
  •  不知归路
    2021-01-11 17:54

    If its only for styling purposes, and you don't want to use a Script, you can do it that way..

    lets say that you want to style the elements between .c3 and .c6

    .c3 ~ div
    {
        /*special styling*/
    }
    div, .c6 ~ div
    {
        /*normal styling*/
    }
    

    you can see it in action Here

提交回复
热议问题