CSS selector to get deepest element of specific class in the HTML tree

前端 未结 8 2337
温柔的废话
温柔的废话 2020-11-28 14:49

I\'ve got a a bunch of DIV elements in my HTML, several of which have their class attribute set to \"rowsLayout\". Some of these rowsLayout DIVs can be nested inside one an

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 15:46

    select them by ID

    #b, #d, #e {
     /* styles here */
    }
    

    any reason for all the repeat class names btw? You could wrap the whole thing in div of #layout or something then do...

    #layout div {
     /* styles */
    }
    

    instead of adding that class name to ever div.

提交回复
热议问题