How to get first child to work with JSS-Nested

无人久伴 提交于 2020-01-25 08:33:08

问题


I am using the jss preset default and it comes with jss-nested.

I could get '&:hover' to work but '&:first-child' does not work for me.

sample code:

    summaryItem: {
    borderLeft: '2px solid red',
    '&:first-child': {
        borderLeft: '2px solid transparent',
      }
    }

回答1:


You need to add a space for calling child selectors else it would be like calling div:first-child instead of div > :first-child

    summaryItem: {
    borderLeft: '2px solid red',
    '& > :first-child': {
        borderLeft: '2px solid transparent',
      }
    }


来源:https://stackoverflow.com/questions/52470478/how-to-get-first-child-to-work-with-jss-nested

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!