admin管理员组

文章数量:1314039

What does three ampersands do in Sass?

Here in a styled-ponents context:

const Grid = styled.div`
  display: grid;
  &&& {
    ${someFunction}
  }
`

Seen in code here: .16.0/packages/reakit/src/Grid/Grid.ts#L23

What does three ampersands do in Sass?

Here in a styled-ponents context:

const Grid = styled.div`
  display: grid;
  &&& {
    ${someFunction}
  }
`

Seen in code here: https://github./reakit/reakit/blob/website%400.16.0/packages/reakit/src/Grid/Grid.ts#L23

Share Improve this question asked May 28, 2019 at 12:41 Fellow StrangerFellow Stranger 34.1k37 gold badges178 silver badges250 bronze badges 3
  • it's & parent selector repeating three times, no reason – Vadim Hulevich Commented May 28, 2019 at 12:46
  • @VadimHulevich I'm not sure I'm following. Mind writing up an answer? – Fellow Stranger Commented May 28, 2019 at 12:47
  • 2 I'm not sure it's valid sass. I just tried to run that, and got the following error: "&" may only used at the beginning of a pound selector.. Maybe that repo has got some custom pile options specified somewhere, just looking now... – Alicia Sykes Commented May 28, 2019 at 12:48
Add a ment  | 

1 Answer 1

Reset to default 10

The docs say it is to override any already given styles with a higher specificity, as an alternative to using !important.

It affects the generated css classes.

本文标签: javascriptTriple ampersand in SassStack Overflow