Articles → HTML → Conditional Comments In HTML
Conditional Comments In HTML
Purpose Of Conditional Comments
Syntax
<!--[if (expression)]>HTML<![endif]-->
Predefined Strings
- IE → Check whether the browser is internet explorer or not
- WindowsEdition → Check the operating system installed on the client’s machine
Example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!--[if (IE)]> Internet Explorer <![endif]-->
<!--[if !(IE)]><!--> Other than IE<!--<![endif]-->
</body>
</html>
Output
Click to Enlarge