admin管理员组文章数量:1297060
I'm making a website at the moment and for some reason the z-index of a see through overlay is not working in internet explorer (it works in everything else), therefore I want to display a warning message that the website does not support internet explorer, how can I make a div with the class "Warning" show up only in internet explorer?
I am happy to this via any method (HTML, CSS, Jquery etc) as long as it either resolves the z-index issue or makes the warning div show.Update: I had a friend of mine test my website and the conditional ments don't work in IE11, I want the div to be displayed in all versions of IE.
I'm making a website at the moment and for some reason the z-index of a see through overlay is not working in internet explorer (it works in everything else), therefore I want to display a warning message that the website does not support internet explorer, how can I make a div with the class "Warning" show up only in internet explorer?
I am happy to this via any method (HTML, CSS, Jquery etc) as long as it either resolves the z-index issue or makes the warning div show.Update: I had a friend of mine test my website and the conditional ments don't work in IE11, I want the div to be displayed in all versions of IE.
Share Improve this question edited Mar 1, 2014 at 0:34 asked Feb 28, 2014 at 0:02 user3186203user31862033 Answers
Reset to default 6You can use a conditional statement to show the div
:
<!--[if IE]>
<div class="warning">...</div>
<![endif]-->
This will work for all versions of IE, if you want to target specific versions, see here for more info.
EDIT: As GSerg has pointed out, this will only work for < IE11. For later versions of IE, you may have to rely on some JS like in this Q&A: Browser detection in JavaScript?
Html5 Boilerplate remends this solution (checkout this link for more details):
<!--[if lt IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy./">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
Wrap your html in a conditional like so:
<!--[if lt IE 7]>[html here]<![endif]-->
the lt
means 'less than'. You can target various version of IE by using lt
, gt
(greater than), lte
(less than or equal to) and gte
(greater than or equal to).
本文标签: javascriptDisplay div only in IEStack Overflow
版权声明:本文标题:javascript - Display div only in IE - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741611966a2388312.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论