IE conditional comments to target ie9/ie10 and non-ie browser
See original GitHub issueConsider adding a conditional comment to target ie9, ie10 and non ie-browser :
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 9]><!--> <html class="no-js gt-ie9 non-ie" lang="en"> <!--<![endif]-->
This allows to differentiate ie9 from browsers that offer a better support of html5/css3 (ie10, chrome, FF, safari) and to write rules that should never be applied when the browser is Internet Explorer.
I just needed that on site’s form for graceful degradation of the placeholder attribute without using any javascript. This allows to hide form labels and use placeholder where supported (ie10, chrome, FF, saf.) and to show labels where placeholders are not supported (ie9 and below).
Issue Analytics
- State:
- Created 12 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Internet Explorer Conditional Comments - SitePoint
This conditional comment will select all IE browsers with version numbers greater than or equal to 6, which will obviously include IE7 and...
Read more >Internet Explorer Conditional Comments - David Walsh Blog
Luckily Internet Explorer has been supporting conditional comments which allow us to target blocks of HTML toward all IE browsers or ...
Read more >Target IE 9 AND less with conditional comments
IE10 doesn't understand conditional comments, but that simply means it sees the lt IE 10 and everything else inside as one giant HTML ......
Read more >Conditional Comment CSS - WordPress Codex
Conditional comments provide a way of serving specific content to various versions of Internet ... If you want to target all versions of...
Read more >Conditional Comments for Internet Explorer | ITGeared
In some cases, you may simply want to target Internet Explorer (IE) browsers or specific versions of IE browsers. You can accomplish this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We already had this, but it has been removed in #142 because IE9 is not so bad compared to it’s predecessors.
Since IE10 doesn’t recognize any conditional comments, <!–[if gt IE 9]> actually means the same thing to it as <!–[if !IE]>. So shouldn’t it be changed to <!–[if !IE]> now that we know that? Or will that confuse developers who think that means (logically) that it’s not going to target IE10? So it’s either support the correct way that’s confusing, or continue to support the old way that’s more logically correct, but is actually meaningless…
Leave it to Microsoft to make a statement as simple as [if !IE] not exclude all versions of IE. (I get why they’re getting rid of conditional comments; it’s just going to be a weird transitional period – and I can’t imagine there won’t be SOMETHING we’ll still need to detect IE10 for)