:after and :before pseudo-element selectors in Sass [duplicate]

This question already has answers here: Sass .scss: Nesting and multiple classes? (6 answers) Closed 6 years ago. 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 … Read more

CSS content property: is it possible to insert HTML instead of Text?

Just wondering if it’s possible somehow to make the CSS content property insert html code instead string on :before or :after an element like: .header:before{ content: ‘<a href=”#top”>Back</a>’; } this would be quite handy…It could be done through Javascript but using css for this would really make lives easier 🙂 5 Answers 5

Can I change the height of an image in CSS :before/:after pseudo-elements?

Suppose I want to decorate links to certain file types using an image. I could declare my links as <a href=”https://stackoverflow.com/questions/8977957/foo.pdf” class=”pdflink”>A File!</a> then have CSS like .pdflink:after { content: url(‘/images/pdf.png’) } Now, this works great, except if pdf.png isn’t the right size for my link text. I’d like to be able to tell the … Read more

Is it possible to set the stacking order of pseudo-elements below their parent element? [duplicate]

This question already has answers here: How to get a child element to show behind (lower z-index) than its parent? (6 answers) Why can’t an element with a z-index value cover its child? (4 answers) Closed 2 years ago. I am trying to style a element with the :after pseudo element CSS selector #element { … Read more

Is there a way to use SVG as content in a pseudo element ::before or ::after

I would like to use ::before to place SVG images before some selected elements: #mydiv::before { content: ‘<svg … code here</svg>’; display: block; width: 22px; height: 10px; margin: 10px 5px 0 10px; } Above code just displays the plaintext. I checked the spec and there seem to be some restrictions on what content can be. … Read more