:after and :before pseudo-element selectors in Sass
css, css-selectors, pseudo-element, sass
Solution
Use ampersand to specify the parent selector.
SCSS syntax:
p {
margin: 2em auto;
> a {
color: red;
}
&:before {
content: "";
}
&:after {
content: "* * *";
}
}
Problem
How can I use the :before and :after pseudo-element selectors following the syntax of Sass or, alternatively, SCSS? Like this: ``` p margin: 2em auto > a color: red :before content: "" :after content: "* * *" ``` Of course, the above fails.