Suppose the following very simple HTML code:
<div> Hi!</div>
I want to make this div not to show (to disable it, to block it) in case the browser is IE8. How may I do this? Thank you
Suppose the following very simple HTML code:
<div> Hi!</div>
I want to make this div not to show (to disable it, to block it) in case the browser is IE8. How may I do this? Thank you
You can use conditional statements for this, in your case something like this..
<![if !(IE 8)]>
<div> Hi!</div>
<![endif]>
that should do it.
Try conditional statements for IE http://msdn.microsoft.com/en-us/library/ms537512%28VS.85%29.aspx
Using pure HTML
<!--[if !IE8]-->
<div>Hi!</div>
<!--[endif]-->
If you want to hide it using css then you can create IE specific css
<div class="hideIE"> Hi!</div>
<!--[if IE 8]>
<style>
.hideIE
{
display:none;
}
</style>
<![endif]-->
JSFiddle: http://jsfiddle.net/ankur1990/38jxv/
You can try this. Hide div using style
<!--[if IE 8]>
<style>
div { display:none;}
</style>
<![endif]-->
OR, If you want to check for < IE 8
<!--[if lt IE 8]>
<style>
div { display:none;}
</style>
<![endif]-->
You can use HTML 5 boiler plate:
<!--[if IE 8]> <html class="ie8"> <![endif]-->
then you can use:
if( $("html").hasClass("ie8") ) {
$('div.ie8').hide();
};
to hide any div with class ie8
if current browser is IE8
<!--[if IE 8]>
<style type="text/css">
.yourdiv {display:none;}
</style>
<![endif]-->