Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用的是 jss 预设默认值,它带有 jss 嵌套。
我可以让 '&:hover' 工作,但 '&:first-child' 对我不起作用。
示例代码:
summaryItem: { borderLeft: '2px solid red', '&:first-child': { borderLeft: '2px solid transparent', } }
您需要添加一个空间来调用子选择器,否则它就像调用div:first-child而不是div > :first-child
div:first-child
div > :first-child
summaryItem: { borderLeft: '2px solid red', '& > :first-child': { borderLeft: '2px solid transparent', } }