Reputation: 489
https://stackoverflow.com/a/12059220/1421561
I love Davids code, but like to know the best way to give it support in < IE7. My first idea was to use a statement "if there is a child add a class". The class would then link to a background image positioned in a similar way.
What would your solution be?
Here is Davids fiddle: http://jsfiddle.net/w9xnv/2/
Edit: support for this in < IE7:
.menu li > a:after { margin-left: 5px; content: '\25BA'; }
Upvotes: 1
Views: 103
Reputation: 489
It seemed that no one read that I wanted a jQuery backup for this. I understood already that there was no support for this with CSS for IE7.
Anyhow this is my solution, if someone would be looking for the same thing.
JS (jQuery):
<!--[if IE 7]>
<script type="text/javascript">
$(function () {
$("#mainnavi li:has(ul)").addClass("ie7_dropdown_arrow");
});
</script>
<![endif]-->
CSS:
#mainnavi .ie7_dropdown_arrow {
*background: url(../images/dropdown_arrow.png) no-repeat right 0px;
*padding-right: 20px;
}
#mainnavi .ie7_dropdown_arrow:hover {
*background: url(../images/dropdown_arrow.png) no-repeat right -15px;
}
Upvotes: 0
Reputation: 168803
Unfortunately, I don't know of any way to support the :before
and :after
selectors in IE7 or earlier. It simply isn't supported.
For a lot of CSS stuff, there are hacks that can force old IEs to work -- tools like Selectivizr or CSS3Pie.
However I know of no such hacks for :after
. Sorry about that.
You can research it for yourself:
http://caniuse.com/#search=after to confirm browser support. This site also lists relevant resources, which often includes links to relevant hacks. (none listed for this one though)
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills - a pretty comprehensive list of hacks that implement modern browser features in older browsers. Again, no sign of support for :after
here.
My sincere advice is to drop support for IE7 on your site. Unless you have a specific need to support it, the odds are no-one will even notice -- there are very few IE7 users out there these days; the usage for it dropped off much quicker than IE6, and today they're both sitting at under 1% of global browser usage. Judge for yourself whether it's worthwhile sweating over that half percent of users (who are probably well used to seeing sites that don't work properly anyway).
Upvotes: 1