Victor Tsang
Victor Tsang

Reputation: 21

How to get first child to work with JSS-Nested

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',
      }
    }

Upvotes: 2

Views: 6307

Answers (1)

Anwardo
Anwardo

Reputation: 710

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',
      }
    }

Upvotes: 10

Related Questions