I have the following CSS code
.editable:before {
content: url(../images/icons/icon1.png);
padding-right:5px;
}
this is used in conjunction with the following markup:
<span class="editable"></span>
In every other blessed browser in the world my icon is appearing, but IE8 seems to have a problem with this. Isn't the :before
pseudo-element CSS2? isn't content:
also a CSS2 command? what gives?
Actually you should be careful here and read the detail. For full details, see this link - which states
Meaning for browsers
<IE9
- you must use:before
and for>=IE9
- you must use::before
When using :before and :after, just be careful not to use double colons (::after - will not work, but :after will work). I lost about 20mins for this...
IE8 supports
:before
,but notand also images as content when not in compatibility mode. Kudos to @toscho for testing!Source
Detailed comparison of which browsers can deal with what sort of content
How I love quirksmode.org, which makes dealing with this stuff at least half-way bearable. The guy deserves a medal!