2014-10-21 3 views
1
내가 에뮬레이터에서 테스트 할 경우,이 조건문이 작동하지 않는 CSS 스타일

즉, 조건부 HTML 문

<!DOCTYPE html> 
    <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]--> 
    <!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]--> 
    <!--[if IE 8]> <html class="lt-ie9"> <![endif]--> 
    <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]--> 

을 즉, 브라우저를 추가하려면 여기를 조건문을 사용하고

, html 태그가 없습니다 'lt-ie9'클래스.

내가 browserstack 조건문 같은 제품에서 테스트하면 작동하는 것 같다 나는 텍스트 그게 전부는 클래스 뭣 때문에-IE9

조건부 HTML 태그 맞 함께 표시됩니다 볼 수 있습니까? 에뮬레이터를 신뢰하지 않아야합니까?

<!DOCTYPE html> 
    <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]--> 
    <!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]--> 
    <!--[if IE 8]> <html class="lt-ie9"> <![endif]--> 
    <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]--> 
     <head> 
      <meta charset="UTF-8"> 
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 

      <!--jQuery--> 
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 

      <!--css--> 
      <style type="text/css"> 

      .test{ 
      color: red; 
      display: none; 
      font-size: 2em; 
      } 

      .lt-ie9 .test{ 
      display: block; 
      } 

      </style> 


      <!--[if lt IE 9]> 
       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
      <![endif]--> 

      <title>Title of the document</title> 
     </head> 

    <body> 

     <div class="test">IE8</div> 

    </body> 

    </html> 

답변

1

문제의 에뮬레이터를 모르는 상태에서 우리가 알 수있는 방법이 없습니다. 디버깅 작업의 가장 좋은 방법은 해당 코드를 본문에 복사하고 html 태그를 눈에 보이는 것으로 바꾸는 것입니다.

<!--[if lt IE 7]> IE, Less than 7<![endif]--> 
<!--[if IE 7]> IE 7 <![endif]--> 
<!--[if IE 8]> IE 8 <![endif]--> 
<!--[if gt IE 8]><!--> IE 9+ or not-IE <!--<![endif]-->