2008년 9월 8일 월요일

크로스 브라우징 - IE 버전별 스타일 주기

<!--[if IE]>
<style type="text/css">
 #Contents { height:630px; }
</style>
<![endif]-->

html 페이지에 이런식으로 주게되면 IE 브라우저에서 실행하게 된다.
웹표준을 살짝 준수해준 IE 7.0에서는 height:630 만큼만 잡고 그 아래 div 는 떠있는 현상이 생겼다.

IE 6.0 이하에서만 먹도록 적용해야 하기에 IE 버전별로 적용시키는 방법을 찾아보았다.

찾아보던중 발견한 정리잘된 블로그 : http://blog.naver.com/http500/30007831394

이하 위 블로그 내용 임의 편집

IE 선택적 적용(Conditional Comments) 부분, ie에서만 동작기하길 원하는 js나 ie의 css 버그 처리 때문에 사용하는 경우 많음

[ http://www.positioniseverything.net/articles/multiIE.html ][ http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp?frame=true ]

gt = selects greater than  보다큰 :  if gt IE 6 ->  현재버전 > 6
lt = selects less than 보다 작은 :  if lt IE 6 ->  현재버전 < 6
gte = selects greater than or equal to 같거나 큰  :  if gte IE 6 ->  현재버전 >= 6
lte = selects less than or equal to 같거나 작은  :  if lte IE 6 ->  현재버전 <= 6

그밖에 ! 

  1. To select exclusivly for any  non IE  - use " IE  & !IE " for a downlevel-revealed within a downlevel-hidden CC
    <!--[if IE]><![if !IE]><![endif]-->  html  <!--[if IE]><![endif]><![endif]-->
  2. To select for  IE 5.01 only  - use " IE 5.0 " or "lte IE 5.0" or "!gt IE 5.0" or "lt IE 5.5000" or "!gte IE 5.5000"
    <!--[if IE 5.0]>  html  <![endif]-->
  3. To select for  IE 5.5 or 6 or 7.0  - use " !IE 5.0 " or "!lte IE 5.0" or "gt IE 5.0" or "!lt IE 5.5000" or "gte IE 5.5000" (all less specific)
    <!--[if !IE 5.0]>  html  <![endif]-->
  4. To select for  IE 5.5 only  - use " IE 5.5000 "
    <!--[if IE 5.5000]>  html  <![endif]-->
  5. To select for  IE 5.01 or 6 or 7.0  - use " !IE 5.5000 " (less specific)
    <!--[if !IE 5.5000]>  html  <![endif]-->
  6. To select for  IE 6 only  - use " IE 6 "
    <!--[if IE 6]>  html  <![endif]-->
  7. To select for  IE 5.01 or 5.5 or 7.0  - use " !IE 6 " (less specific)
    <!--[if !IE 6]>  html  <![endif]-->
  8. To select for  IE 7.0 only  - use " IE 7.0 "; or less specific "!lte IE 6" or "gt IE 6" or "!lt IE 7.0" or "gte IE 7.0" or "!lt IE 7" or "IE 7" or "gte IE 7"
    <!--[if IE 7.0]>  html  <![endif]-->
  9. To select for  IE 5.01 or 5.5 or 6  - use " lte IE 6 " or "!gt IE 6" or "lt IE 7.0" or "!gte IE 7.0" or "lt IE 7" or "!gte IE 7"; or less specific "!IE 7.0" or "!IE 7"
    <!--[if lte IE 6]>  html  <![endif]-->
  10. To select for  IE 5.01 or 5.5  - use " IE 5 " or "lte IE 5" or "!gt IE 5" or "lte IE 5.5000" or "!gt IE 5.5000" or "lt IE 6" or "!gte IE 6"
    <!--[if IE 5]>  html  <![endif]-->
  11. To select for  IE 6 or 7.0  - use " !IE 5 " or "!lte IE 5" or "gt IE 5" or "!lte IE 5.5000" or "gt IE 5.5000" or "!lt IE 6" or "gte IE 6" (all less specific)
    <!--[if !IE 5]>  html  <![endif]-->
  12. To select for  IE 5.01 or 6  - use " lte IE 6  & !IE 5.5000 " or, more general, any of 3 pairs ({"lt IE 7", "!IE 7", "lte IE 6"},{"!IE 5.5000"}) for a downlevel-revealed within a downlevel-hidden CC
    <!--[if lte IE 6]><![if !IE 5.5000]>  html  <![endif]><![endif]-->
  13. To select for  IE 5.01 or 7.0  - use " !IE 6  & !IE 5.5000 " (less specific) for a downlevel-revealed within a downlevel-hidden CC
    <!--[if !IE 6]><![if !IE 5.5000]>  html  <![endif]><![endif]-->
  14. To select for  IE 5.5 or 6  - use " lte IE 6  & gte IE 5.5000 " or, more general, any of 9 pairs ({"lt IE 7", "!IE 7", "lte IE 6"},{"gt IE 5.0", "!IE 5.0", "gte IE 5.5000"}) for a downlevel-revealed within a downlevel-hidden CC
    <!--[if lte IE 6]><![if gte IE 5.5000]>  html  <![endif]><![endif]-->
  15. To select for  IE 5.5 or 7.0  - use " !IE 6  & gt IE 5.0 " or, more general, any of 3 less specific pairs ({"!IE 6"},{"gt IE 5.0", "!IE 5.0", "gte IE 5.5000"}) for a downlevel-revealed within a downlevel-hidden CC
    <!--[if !IE 6]><![if gt IE 5.0]>  html  <![endif]><![endif]-->
  16. To select for  IE 5.01 or 5.5 or 6 or 7.0  - use " lte IE 7.0 "; or less specific "gte IE 5" or "gte IE 5.0" or "lte IE 7" or "IE"; it seems not feasible to use any negations for this selection.
    <!--[if lte IE 7.0]>  html  <![endif]-->


XSL 에서는

<xsl:comment><![CDATA[[if lte IE 6]>
<style type="text/css">.ie{ margin-top:30px;margin-bottom:-30px; }</style>
<![endif]]]></xsl:comment>

댓글 2개:

  1. 나 이제.. 너희들이 하는 말을 못알아듣겠어..

    세균이랑 치미랑 너랑 이런 전공 얘기를 나는 하나도 못알아듣겠어..

    흑... 슬프다... 난 아직까지 여기에서 머물러 있는데..

    가끔은 학교로 들어 온 내가 한심해 질때가 있어....

    답글삭제
  2. @BUshishi - 2010/12/30 10:53
    부쉬쉬야 괜찮어~ 나두 내꺼만 알고 우리 남편이랑

    치미랑 세균이랑 하는 전공얘기는 하나도 못알아 들어

    ㅎㅎㅎ

    답글삭제