Pankaj
Parashar

Developer. Designer. Writer.

Hello. I'm Pankaj Parashar, 30yo frontend designer, developer from Mumbai, India. I make things for the web and write about them on my blog here.

Elsewhere,
Twitter | Github | Codepen

Modify pseudo element styles with JavaScript

Quite often I run into situations where I need to modify the CSS styles of the pseudo elements dynamically. This post shows you different ways in which it can be done!

Published on May 01, 2014

Here is the sample markup and styles to start with,

Objective

To modify the color of the pseudo element - .red::before from red to green.

Previous
The HeartBleed Bug

Next
Reading Position Indicator