Pseudo classes :before and :after in IE6-7
Posted on | July 5, 2012 | 3 Comments
Fortunately, there is an alternative.
Solution
An alternative is to use the following in your css file.
[css]
.selector {
*zoom: expression(
this.runtimeStyle.zoom=”1″,
this.appendChild( document.createElement(“small”) ).className=”after”,
this.insertBefore( document.createElement(“small”), this.firstChild ).className=”before”
);
}
.selector .after, /* IE6/7 */
.selector:after {
/* styling here */
}
.selector .before,
.selector:before {
/* styling here */
}
[/css]
This method is faster than downloading a separate javascript file which then has to implement every ie6/7 fix to make it a compliant browser.
The selectors can be maintained in the same css file (does not need to be placed in separate ie-only css file) and all the code can be grouped together.
Posted By:Richard Parnaby-King