etc

IE 버전별 코딩하기 ( CSS , JAVASCRIPT , HTML )

by kay posted Jul 07, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

모든 IE에서만 적용하려면

<!--[if IE]>
	<link rel="stylesheet" type="text/css" href="ie-only.css" />
<![endif]-->

IE6 버전에서만 읽어들이도록

<!--[if IE 6]>
	<link rel="stylesheet" type="text/css" href="ie6-only.css" />
<![endif]-->

IE7 버전에서만 읽어들이도록

<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="ie7-only.css" />
<![endif]-->

조금 더 정교하게.

IE7 버전보다 낮은 버전에서만 (7버전 제외)

<!--[if lt IE 7]>
	<link rel="stylesheet" type="text/css" href="ie7-less-than.css" />
<![endif]-->

IE7 버전보다 낮은 버전에서만 (7버전 포함)

<!--[if lte IE 7]>
	<link rel="stylesheet" type="text/css" href="ie7-less-than-equal.css" />
<![endif]-->

IE7 버전보다 높은 버전에서만 (7버전 제외)

<!--[if gt IE 7]>
	<link rel="stylesheet" type="text/css" href="ie7-greater-than.css" />
<![endif]-->

IE7 버전보다 높은 버전에서만 (7버전 포함)

<!--[if gte IE 7]>
	<link rel="stylesheet" type="text/css" href="ie7-greater-than-equal.css" />
<![endif]-->

기타 다음과 같은 문구도 가능하다.

IE가 아닌 다른 브라우저만

<!--[if !IE]>
	<link rel="stylesheet" type="text/css" href="not-sucks.css" />
<![endif]-->

IE6.5 버전에서만 읽어들이도록

<!--[if IE 6.5000]>
	<link rel="stylesheet" type="text/css" href="ie6.5-only.css" />
<![endif]-->

gt 는 greater than , gte 는 greater than or equal, lt 는 less than, lte 는 less than or equal 의 약자이다. 다음과 같이 스크립트도 삽입할 수 있다.

<!--[if IE 6]>
<script type="text/javascript">
    alert("아직 IE6을 쓰는거야?"); 
</script>
<![endif]-->

출처 : http://blueruin.org/archives/459