How to use pseudo class :not(:first-child)
by @fluentui/react-make-styles?
#18549
-
Environment Information
Please provide a reproduction of the bug in a codepen:Actual behavior:I use const useClasses = makeStyles({
list: {
display: "flex",
flexDirection: "column",
padding: "16px 0px",
":not(:first-child)": { marginTop: "16px" }
},
}); And apply the class name codepen: https://codepen.io/yf1999/pen/ZEeqvPr Expected behavior:The pseudo class Priorities and help requested:Are you willing to submit a PR to fix? No, I don't know how Requested priority: Maybe normal? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
But you want it to be applied to list's children - in that case you need to use const useClasses = makeStyles({
list: {
display: "flex",
flexDirection: "column",
padding: "16px 0px",
"& :not(:first-child)": { marginTop: "16px" }
}
}); Another option would be to use the selector you propose but on the const useClasses = makeStyles({
list: {
display: "flex",
flexDirection: "column",
padding: "16px 0px",
},
item: {
background: "yellow",
height: "10px",
":not(:first-child)": { marginTop: "16px" }
}
}); |
Beta Was this translation helpful? Give feedback.
:not(:first-child)
selector is equivalent of&:not(:first-child)
and applies to thelist
selector in the example. If the generated classname for the list slot islist-1234
, the selector is.list-1234:not(:first-child)
.But you want it to be applied to list's children - in that case you need to use
& :not(:first-child)
(with&
andSPACE
) in the selector to identify children:Another option would be to use the selector you propose but on the
item
slot: