No idea why :before won't work. My IE8 browser will display it correctly on this page:
http://quirksmode.org/css/selectors/beforeafter.html
but not when I do it on this page:
No idea why :before won't work. My IE8 browser will display it correctly on this page:
http://quirksmode.org/css/selectors/beforeafter.html
but not when I do it on this page:
IE8 does support :before
.
Two possibilities:
IE is rendering the page in compatibility mode or quirks mode.
Either of these modes will disable this functionality. Add a valid doctype and set X-UA-Compatible
to IE=edge
to deal with this.
You're using ::before
rather than :before
.
This is quite a subtle one. The correct syntax is with a double-colon, but at the time IE8 was released, it was a single colon; the official syntax has been changed subsequently. All modern browsers will accept either single or double colon for ::before
and ::after
to accommodate this historical change, but IE8 is stuck only supporting the single colon.
it works as long as you aren't in compatability mode. If you want it to support more I might recommend the following:
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
Removing the ::before
and ::after
selectors seems to get it work in IE8:
p.test:before {
padding-right: 5px;
content: url(http://quirksmode.org/pix/logo_ppk.gif);
}
p.test:after {
font-style: italic;
content: " and some text after.";
}