Advantages and disadvantages of conditional comments in IE

Advantages and disadvantages of conditional comments in IE

IE's conditional comments are a proprietary (and therefore non-standard) Microsoft extension to regular (X)HTML comments.
IE's conditional comments are a proprietary (and therefore non-standard) Microsoft extension to regular (X)HTML comments. As the name suggests, conditional comments enable you to display a block of code based on a condition (such as the browser version). Although non-standard, conditional comments appear as regular comments to all other browsers and are therefore essentially harmless. Conditional comments first appeared in IE5 on Windows and have been supported by all subsequent versions of the Windows browser.
IE's conditional comments are extremely effective and very easy to remember. The main disadvantage is that these comments need to be placed in the HTML page, not in the CSS. In this way, when you don't need these things or make some changes, you need to maintain a lot of places.
Let’s look at a few examples –
Only IE can recognize it <br />Because only IE5 and above versions support IE conditional comments, so "only IE" can recognize it means "only IE5 and above versions" can recognize it.

Only specific versions can be recognized <br />For example, only IE5 can be recognized, only IE6 can be recognized, only IE7 or IE8 can be recognized. The identification condition is a specific version, neither higher nor lower versions are acceptable. For example, the following code block will only work in IE8
<!--[if IE 8]>
<style type="text/css">
@import "test.css";
</style>
<![endif]-->


Only versions that are not specific can be recognized . Of course, IE browser needs to be version 5 or above to be within the scope of discussion. For example, in the following example, IE7 is specified as not being recognized.
<!--[if !IE 7]>
<style type="text/css">
@import "test.css";
</style>
<![endif]-->


Previous Page 1 2 3 Next Page Read More

<<:  Vue installation and use

>>:  How to add docker port and get dockerfile

Recommend

Implementation of docker-compose deployment of zk+kafka+storm cluster

Cluster Deployment Overview 172.22.12.20 172.22.1...

View the number of files in each subfolder of a specified folder in Linux

count script #!/bin/sh numOfArgs=$# if [ $numOfAr...

How to use jsx syntax correctly in vue

Table of contents Preface Virtual DOM What is Vir...

How to forget the root password in Mysql8.0.13 under Windows 10 system

1. First stop the mysql service As an administrat...

Use nginx to configure domain name-based virtual hosts

1. What is a virtual host? Virtual hosts use spec...

How to process blob data in MySQL

The specific code is as follows: package epoint.m...

Why MySQL chooses Repeatable Read as the default isolation level

Table of contents Oracle Isolation Levels MySQL I...

Introduction to fork in multithreading under Linux

Table of contents Question: Case (1) fork before ...

MySQL 5.7.17 Compressed Version Installation Notes

This article shares the installation steps of MyS...

MySQL: Data Integrity

Data integrity is divided into: entity integrity,...

Vue+thinkphp5.1+axios to realize file upload

This article shares with you how to use thinkphp5...

Mysql database master-slave separation example code

introduce Setting up read-write separation for th...

HeidiSQL tool to export and import MySQL data

Sometimes, in order to facilitate the export and ...