:after and :before CSS pseudo elements hack for Internet Explorer 7
with any pure CSS hack it's not possible.
Use IE8.js http://code.google.com/p/ie7-js/
It has support for this. http://ie7-js.googlecode.com/svn/test/index.html
test page also there
after - http://ie7-js.googlecode.com/svn/test/after.html
before - http://ie7-js.googlecode.com/svn/test/before.html
Edit after 1st comment
You can just keep this js for IE6 and 7. other browser will not read it.
<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->
And if you are already using jQuery in your project than you can use this plugin
jQuery Pseudo Plugin
http://jquery.lukelutman.com/plugins/pseudo/
Is there a faster way to give :before and :after selector support in IE7?
From the comments:
If you have zillions of
:before
and
:after
, the cause of the problem could
be IE7's slowish JavaScript engine -
if this is the case, I think you're
out of luck - IE7.js is probably as
efficient as you're going to get.
and:
@thirtydot I have a page with only one
:before and :after and that is taking
about 7-9 seconds, so I think you are
right about it being the number of
selectors I'm using.
IE7 :(
What is the alternative for using :after and :before in IE7
Here is the link on stackoverflow and the same question, somehow I am sure you'll find the answer you want here.
:after and :before css pseudo elements hack for IE 7
Support of :after in IE7
There is no support for :before
and :after
in IE7, there are other options that you can use like IE8.js.
Use after: and before: selectors in versions 6 and 7 of Internet Explorer
The before and after css elements should work in ie8 and up.
For IE7 you can use something like Use the IE7.js hack to add after & before pseudo element support.
I would recommend using a conditional statement to include the file such as;
<!--[if IE 7]>
insert script here
<![endif]-->
For IE6, I personally would not bother and just degrade gracefully.
Another option is to use ie-css3.js.
:after pseudoclass on IE7
style .arrow in conditional comments specifically for ie7. ie7 doesn't understand :after,:before,:content or display:inline-block for that matter. without looking at the site, it's hard to offer a solid fix. offhand, i'd make it display:block; with a text-indent and use background-image.
CSS :after on ie7, jquery pattern
Would be interesting to see your CSS, but in lack of that I guess that your content should read:
url(/images/image.jpg)
starting with the slash so that the path starts at your server's root (instead of being relative to your current folder).
Edit: So, in summary I'd suggest the following style:
#yourElementId, #yourElementId:after {
after: url(/images/image.jpg); /* IE7 polyfill */
content: url(/images/image.jpg); /* css for other browsers */
}
Related Topics
Is There a CSS Selector For the First Direct Child Only
How to Change the Color of Radio Buttons
Why Are Nested Anchor Tags Illegal
Adding a Favicon to a Static HTML Page
Maintain Aspect Ratio of Div But Fill Screen Width and Height in Css
Scraping Data from Website Using Vba
How to Make a HTML Page in A4 Paper Size Page(S)
"X-Ua-Compatible" Content="Ie=9; Ie=8; Ie=7; Ie=Edge"
How to Get Centered Content Using Twitter Bootstrap
Col-Xs-*' Not Working in Bootstrap 4
How to Prevent Downloading Images and Video Files from My Website
Set Content Height 100% Jquery Mobile
Set Textview Text from Html-Formatted String Resource in Xml
How to Center a Button Within a Div