Trying to figure out how to give two paragraphs different background colors using nth-child. Here's the JSX:
<div className={classes.paragraphs}>
<p>Test 1</p>
<p>Test 2</p>
</div>
And the CSS:
const useStyles = makeStyles(() => ({
paragraphs: {
backgroundColor: "blue",
"&:nth-child(1)": {
backgroundColor: "green"
}
}
}));
Despite specifying a green background for the first paragraph, both paragraphs end up with a blue background.