Skip to content

Instantly share code, notes, and snippets.

@vieron
Created March 2, 2012 08:29
Show Gist options
  • Save vieron/1956766 to your computer and use it in GitHub Desktop.
Save vieron/1956766 to your computer and use it in GitHub Desktop.
:after and :before for IE6+ with a SASS mixin
@mixin pseudo-element($type : "before", $content : "", $css_property : "zoom") {
& {
*#{$css_property}: expression(
this.runtimeStyle.zoom="1",
(is_before_element = ("#{$type}" == 'before')),
(e = this[ is_before_element ? 'insertBefore' : 'appendChild']( document.createElement("small"), is_before_element ? this.firstChild : null )),
e.innerHTML="#{$content}",
e.className="#{$type} pseudo-element"
);
}
&:before {
content : $content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment