conditional statements interpreted by Microsoft Internet Explorer versions 5 through 9 in HTML source code

About conditional comments (Internet Explorer) | Microsoft Learn
docs.microsoft.com →While many websites use feature detection to ensure their sites provide different experiences for browsers of different capabilities, some legacy websites use other techniques, such as the use of script on the server or client, to detect the browser.Here we introduce conditional comments, which offer advantages over scripted browser detection techniques. Conditional comments make it easy to detect earlier versions of Windows Internet Explorer. Conditional comments are the preferred means of differentiating Cascading Style Sheets (CSS) rules intended for specific versions of Internet Explorer. Important As of Internet Explorer 10, conditional comments are no longer supported by standards mode. Use feature detection to provide effective fallback strategies for website features that aren't supported by the browser. For more info about standards mode, see Defining Document Compatibility) . As you continue to learn about document compatibility, it's helpful to be familiar with the following terms. expression A combination of operators, features, and/or values used to form a conditional statement. downlevel browser Any browser except Microsoft Internet Explorer 5 and later versions. For the purposes of this article, downlevel refers specifically to any browser or browser version that doesn't support conditional comments. uplevel browser Internet Explorer 5 and later versions, which support conditional comments. downlevel-hidden A conditional comment block that is ignored by downlevel browsers. Internet Explorer 5 and later versions render the HTML content if the expression evaluates to true . downlevel-revealed A conditional comment block that is parsed by downlevel browsers. Internet Explorer 5 and later versions also render the HTML content if the expression evaluates to true . Here's a list of advantages that conditional comments have over scripting methods to determine the browser you're using. When a downlevel browser encounters a downlevel-hidden conditional comment, the browser skips over the HTML inside the comment, and the content elements aren't parsed, downloaded, or rendered. This saves client machine resources. Conditional comments don't require scripting and DHTML, and when no scripting is used in a webpage, no scripting engine needs to be loaded. Conditional comments are processed during the downloading and parsing phase, so only the content that's targeted for the browser is actually downloaded. Conditional comments can be combined freely with other browser detection techniques. Using conditional comments, script logic can be separated into smaller and simpler segments of code, which are easier to understand and maintain. Plus, code segments are loaded only by the browser version for which they were intended. Conditional comments have been around since Internet Explorer 5, but their use isn't restricted to Internet Explorer alone. Conditional comments can be used to customize content delivered to browsers that support conditional comments and those that don't. The basic syntax of each type of comment is shown in this table. The first comment shown is the basic HTML Comment , which is included for comparison and to show the different syntax used by each type of conditional comment. 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, depending on the feature. This table shows the supported features and describes the values each feature supports. This table describes the operators you can use to create conditional expressions. This sample shows a downlevel-hidden conditional comment, which contains a short paragraph of text. The downlevel-hidden conditional comment contains hyphens ("--") in the
Excerpt from a page describing this subject · 16,721 chars · not written by Vinony
via Wikidata · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).