IT News/PHP

if IE 명령어 사용법 <!--[if IE 6]><![endif]-->

skyLove1982 2011. 5. 12. 11:05
반응형

위 명령어는 익스플러에서만 동작하므로 각 조건안에

<link rel="stylesheet" type="text/css" href="ie6.css">

 이렇게 하면 안된다. 왜냐하면 파이어폭스나 크롬등에서 문제가 될수있기 때문이다.

 그러나  아래와 같이 사용하여 해결할 수도 있다.

 

 

IE7일 경우 ie7only.css를 사용
<!--[if IE 7]>  <link rel="stylesheet" type="text/css"  href="ie7only.css"><![endif]-->
IE이 아닐 경우 non-IE.css를 사용
<![if !IE]>  <link rel="stylesheet" type="text/css"  href="non-ie.css"><![endif]>

하지만 link rel 보다는 각 버전별로 스타일을 추가하거나 변경하는 식으로 해도될것 같다.
<!--[if gte IE 8]> <style type="text/css"> html,body { height:100%}  </style> <![endif]-->  이런식으로...

 

if IE 명령어 사용법

<!--[if IE]>
IE에만 표시할 내용
<![endif]-->

버전별로 따로 설정을 할 수도 있습니다.

<!--[if IE 7]>
IE7에만 표시할 내용
<![endif]-->

<!--[if gt IE 7]>
IE7 초과 유저에게만 표시할 내용
<![endif]-->

<!--[if  lt IE 7]>
IE7 미만 유저에게만 표시할 내용
<![endif]-->

<!--[if gte IE 7]>
IE7 이상 유저에게만 표시할 내용
<![endif]-->

<!--[if lte IE 7]>
IE7 이하 유저에게만 표시할 내용
<![endif]-->

더 자세한 내용은 http://hooney.net/2007/08/27/451/ 

반응형