Skip to content

Instantly share code, notes, and snippets.

@kazu69
Created January 19, 2014 16:41
Show Gist options
  • Save kazu69/8507331 to your computer and use it in GitHub Desktop.
Save kazu69/8507331 to your computer and use it in GitHub Desktop.
Get Pseudo-Element Properties with JavaScript see http://davidwalsh.name/pseudo-element js-fiddle: http://jsfiddle.net/kazu69/a6C39/
<div id="box">aaaaaaa</div>
var color = window.getComputedStyle(document.querySelector("#box", ':before')).getPropertyValue('color');
console.log(color);
#box:before {
content: 'BEFORE';
color: rgb(255, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment