所有的IE都起作用:
**<!--[if IE]> <link rel="stylesheet" type="text/css" href="all-ie-only.css/> <![endif]-->**
IE以外的浏览器起作用:
<!--[if !IE]><!--> <link rel="stylesheet" type="text/css" href="not-ie.css" /> <!--<![endif]-->
只有IE7起作用:
<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="ie7.css"> <![endif]-->
只有IE6起作用:
<!--[if IE 6]> <link rel="stylesheet" type="text/css" href="ie6.css"/> <![endif]-->
只有IE5起作用:
<!--[if IE 5]> <link rel="stylesheet" type="text/css" href="ie5.css"/> <![endif]-->
只有IE5.5起作用:
<!--[if IE 5.5000]> <link rel="stylesheet" type="text/css" href="ie55.css"/> <![endif]-->
只对IE6及以下的版本起作用:
<!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->
<!--[if lte IE 6]> <link rel="stylesheet" type="text/css" href="ie6-and-down.css"/> <![endif]-->
只对IE7及以下的版本起作用:
<!--[if lt IE 8]> <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->
<!--[if lte IE 7]> <link rel="stylesheet" type="text/css" href="ie7-and-down.css"/> <![endif]-->
只对IE8及以下的版本起作用:
<!--[if lt IE 9]> <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->
<!--[if lte IE 8]> <link rel="stylesheet" type="text/css" href="ie8-and-down.css"/> <![endif]-->
只对IE6及以上的版本起作用:
<!--[if gt IE 5.5]> <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->
<!--[if gte IE 6]> <link rel="stylesheet" type="text/css" href="ie6-and-up.css"/> <![endif]-->
只对IE7及以上的版本起作用:
<!--[if gt IE 6]> <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->
<!--[if gte IE 7]> <link rel="stylesheet" type="text/css" href="ie7-and-up.css"/> <![endif]-->
只对IE8及以上的版本起作用:
<!--[if gt IE 7]> <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->
<!--[if gte IE 8]> <link rel="stylesheet" type="text/css" href="ie8-and-up.css"/> <![endif]-->
通过判断浏览器类型而加载不同的css样式
于 2023-03-30 16:53:54 首次发布
这些代码片段展示了如何使用HTML条件注释来针对不同版本的InternetExplorer应用特定的CSS样式表。例如,all-ie-only.css将只在所有IE版本中加载,而not-ie.css则适用于非IE浏览器。这种方法允许开发者为不同IE版本解决兼容性问题。
摘要由CSDN通过智能技术生成