Search Results for 'Language/WebStandards'


  1. 2009|06 HTML- CSS - Syntax of Conditional Comments(조건부)
  2. 2009|02 웹 표준 css 를 이용한 컨트롤

        <!-- IE 가 아닐경우 -->
        <![if !IE]>
            <link href="${contextPath}/css/event/2009060101_event.css" rel="stylesheet" type="text/css" media="all">
        <!-- IE 일경우 -->
        <!--[if IE]>
            <link href="${contextPath}/css/event/2009060101_event_ie.css" rel="stylesheet" type="text/css" media="all" />
        <!--[if lt IE 8]>
            <link href="${contextPath}/css/main_ie_lt_8.css" rel="stylesheet" type="text/css" media="all" />

참고 URL

Syntax of Conditional Comments

The basic syntax of each type of comment is shown in the following table. The first comment shown is the basic HTML Comment, which is included for the purpose of comparison and to illustrate the different syntax used by each type of conditional comment.

Comment typeSyntax or possible value
standard HTML comment<!-- Comment content  -->
downlevel-hidden<!--[if expression]> HTML <![endif]-->
downlevel-revealed<![if expression]> HTML <![endif]>

The HTML shown inside the syntax block in each of the conditional comments denotes any block of HTML content, including script. Both types of conditional comment use a conditional expression to indicate whether the content inside the comment block should be parsed or ignored.

The conditional expression is formed from a combination of feature, operator, and/or value, as shown in the following table.

IE[if IE]The only currently supported feature is the string "IE", corresponding to Internet Explorer.
value[if IE 7]An integer or floating point numeral corresponding to the version of the browser. Returns a Boolean value of true if the version number matches the browser version. For more information, see Version Vectors.
![if !IE]The NOT operator. This is placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the expression.
lt[if lt IE 5.5]The less-than operator. Returns true if the first argument is less than the second argument.
lte[if lte IE 6]The less-than or equal operator. Returns true if the first argument is less than or equal to the second argument.
gt[if gt IE 5]The greater-than operator. Returns true if the first argument is greater than the second argument.
gte[if gte IE 7]The greater-than or equal operator. Returns true if the first argument is greater than or equal to the second argument.
( )[if !(IE 7)]Subexpression operators. Used in conjunction with boolean operators to create more complex expressions.
&[if (gt IE 5)&(lt IE 7)]The AND operator. Returns true if all subexpressions evaluate to true
|[if (IE 6)|(IE 7)]The OR operator. Returns true if any of the subexpressions evaluates to true.
true[if true]Always evaluates to true.
false[if false]Always evaluates to false.

Downlevel-hidden Conditional Comments

The following sample shows a downlevel-hidden conditional comment, which contains a short paragraph of text.

<!--[if IE 5]>
<p>Welcome to Internet Explorer 5.</p>

The downlevel-hidden conditional comment contains hyphens ("--") in the opening and closing tag, similar to the basic HTML Comment. The condition appears in the opening portion of the tag, and [endif] is placed prior to the closing portion of the tag. The content is placed inside the comment tags.

Because the first four characters and the last three characters of the comment are identical to a basic HTML Comment element, downlevel browsers ignore the HTML content inside the comment block. Since content is effectively hidden from browsers that do not support conditional comments, this type of conditional comment is called downlevel-hidden.

If the result of the conditional expression is true, the content inside the comment block is parsed and rendered by Internet Explorer 5 and later versions. This behavior makes the downlevel-hidden conditional comment particularly useful for content that has been specifically designed for Internet Explorer.

The following sample illustrates how a client-side script block can be placed inside a conditional comment; in this case, a message is displayed in Internet Explorer 5 and later.

<!--[if gte IE 5]>
<SCRIPT LANGUAGE="Javascript">
alert("Congratulations! You are running Internet Explorer 5 or greater.");
<P>Thank you for closing the message box.</P>
This feature requires Microsoft Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

In the preceding example, only the major digit of the browser version is compared because it is the only digit specified in the conditional expression. To compare both major and minor version numbers, specify both digits. For further explanation and examples on specifying the browser's version number, see Version Vectors.

Downlevel-revealed Conditional Comments

The downlevel-revealed conditional comment enables you to include content in browsers that do not recognize conditional comments. Although the conditional comment itself is ignored, the HTML content inside it is not. Internet Explorer 5 and later versions also parse and render the content if the conditional expression evaluates to true. The downlevel-revealed conditional comment complements the downlevel-hidden conditional comment.

The following snippet shows a typical downlevel-revealed conditional comment.

<![if lt IE 5]>
<p>Please upgrade to Internet Explorer version 5.</p>

When comparing this type of comment to the basic HTML Comment, notice that there are no hyphens ("--") immediately after the opening "<!" or immediately before the closing ">" of the comment block; therefore, the comment delimiters are treated as unrecognized HTML. Because the browser does not recognize the downlevel-revealed conditional comment, it does nothing with it.

Version Vectors

Conditional expressions are often used to determine the version of the browser. The format of the version vector number must be defined correctly to obtain the desired result.

When testing the major browser version number, the version vector is an integer. To check for a minor browser version, follow the version vector by a decimal point and four digits. For example, the version vector for the release build of Internet Explorer 5.5 is 5.5000.

In the following example, only the major version number is specified; therefore, the sample evaluates as true for both Internet Explorer 5 and Internet Explorer 5.5.

<!--[if IE 5]>
<p>Welcome to any incremental version of Internet Explorer 5!</p>

The following test correctly identifies Internet Explorer 5.

<!--[if IE 5.0000]>
<p>Welcome to Internet Explorer 5.0!</p>
Note  Internet Explorer 5, which shipped with Microsoft Windows 2000, has a version vector equal to 5.0002. Therefore, the conditional expression [if lte IE 5.0000] returns false when evaluated in the release build of Internet Explorer 5.


Here are some more examples of conditional comments.
<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->

<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->

<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>

<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]>

※ 위 내용은, 여러 자료를 참고하거나 제가 주관적으로 정리한 것입니다.
   잘못된 정보나 보완이 필요한 부분을, 댓글 또는 메일로 보내주시면 많은 도움이 되겠습니다.

"Language / WebStandards" 분류의 다른 글

웹 표준 css 를 이용한 컨트롤 (0)2009/02/12
06 26, 2009 12:51 06 26, 2009 12:51

Trackback URL :

Leave a comment
오픈아이디로만 댓글을 남길 수 있습니다

Recent Posts

  1. HDFS - Python Encoding 오류 처리
  2. HP - Vertica ROS Container 관련 오류...
  3. HDFS - Hive 실행시 System Time 오류
  4. HP - Vertica 사용자 쿼리 이력 테이블...
  5. Client에서 HDFS 환경의 데이터 처리시...

Recent Comments

  1. 안녕하세요^^ 배그핵
  2. 안녕하세요^^ 도움이 되셨다니, 저... sunshiny
  3. 정말 큰 도움이 되었습니다.. 감사합... 사랑은
  4. 네, 안녕하세요. 댓글 남겨 주셔서... sunshiny
  5. 감사합니다 많은 도움 되었습니다!ㅎㅎ 프리시퀸스

Recent Trackbacks

  1. Roku App Development Roku App Development 3 07
  2. safety goggles safety goggles 2 07
  3. custom wheelchair for dogs custom wheelchair for dogs 30 06
  4. phoenix digital marketing agency phoenix digital marketing agency 29 06
  5. streaming tv channels streaming tv channels 28 06


«   07 2020   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  


  1. 위키피디아
  2. MysqlKorea
  3. 오라클 클럽
  4. API - Java
  5. Apache Hadoop API
  6. Apache Software Foundation
  7. HDFS 생태계 솔루션
  8. DNSBL - Spam Database Lookup
  9. Ready System
  10. Solaris Freeware
  11. Linux-Site
  12. 윈디하나의 솔라나라

Site Stats

TOTAL 2998835 HIT