[CSS] 인터넷 익스플로러 조건 주석문

title: [ani]깜빡이는 표정빽짱구 | 2007.11.11 01:02:21 | 메뉴 건너뛰기
포인트 : 56948 | 레벨 : 25
  • 미리보기 :

조건 주석문은 윈도우용 IE5 가 나오면서 선보인 기능으로서 그 이후에 나온 윈도우용 모든 버전에서 지원하고 있습니다.
특정 스타일시트 IE5 이상 브라우저에 적용하려면 다음과 같은 코드를 (X)html 문서 헤드 부분에 넣으면 됩니다.

<!– [if IE]
<style type=”text/css”>
@import (”style.css”);
</style>
–>


위와 같이 할경우 IE5 이상 버전에서는 style.css 를 읽어드리고, 나머지 브라우저에서는 주석문으로 인식합니다.
IE5 같은 특정 버전의 브라우저가 대상이 되도록 할려면 아래와 같은 방법으로 할 수 있습니다.

<!– [if IE 5]
<style type=”type/css”>
@import (”style.css”);
</style>
–>


5.5 이상 브라우저를 대상으로 할려면

<!– [if gte IE 5.5000]

IE5와 5.5를 대상으로 할려면

<!– [if it IE 6]

위와 같은 기법들은 아주 잘 동작하면서 상대적으로 외우기도 쉽습니다. 단 이 주석문은 css 파일이 아니라 html에 써야 합니다. 그러므로 특정 브라우저를 더이상 지원하지 않게 될 경우 모든 페이지마다 해당 주석문을 제거해야 합니다.


<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>
태그
회원님의 소중한 댓글 부탁드립니다.
추천수 10단위당 메달이 1개씩 노출되고, 추천수에 따라 배경색이 변하며, 일정수의 추천수를 받을시 BEST 아이콘이 붙게됩니다.
추천수에 따른 배경색 보기 본문으로 바로가기
  • 추천수 50개이상
  • 추천수 30개이상
  • 추천수 20개이상
  • 추천수 10개이상
  • 추천수 3개이상
닫기

댓글 [1]

CSS [123]

쓰기
통합 검색창

Quick menu