Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show text in IE only

Tags:

html

I need to show text on IE only and not show it for the rest of the browsers. Any pointers to that? I looked around couldn't find it.

like image 635
Fahim Akhter Avatar asked Feb 16 '10 11:02

Fahim Akhter


2 Answers

Conditional comments.

e.g.

<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->

(There are operators in the condition for less than, less than or equal, ... and you can chain branches to provider different behaviours for different versions see here for full details.)

like image 131
Quentin Avatar answered Sep 18 '22 00:09

Quentin


Please note that since IE 10 conditional commenting are no longer supported and are treated as regular comments:

http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx

In order for it function as before you need to add the meta tag:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">

There for, for me, if I need to detect IE (although I try to avoid browser detection and use feature detection) I use some code of JS as of here:

Detect IE version (prior to v9) in JavaScript

Best.

like image 42
aviv Avatar answered Sep 18 '22 00:09

aviv