In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use conditional comments to judge that the IE browser version is suitable for IE5.0 and above, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
IE conditional comments are special HTML comments that can only be understood by IE5.0 and above. For example, a common HTML comment is:
The IE condition comments that are readable only by IE are:
Non-IE condition comments:
Non-IE HTML Code
"non-specific version IE conditional comments" (rarely used):
Code for browsers that match the if condition
In short, all browsers except "IE on Windows" will think that a conditional comment is just a normal HTML comment. You cannot use conditional comments in CSS code. IE conditional comments are a useful way to hide or show specific code from IE, and it is more reasonable to use IE conditional comments to write CSS "hacks" than to make bug with weird _ / in CSS. Generally speaking, conditional comments are if judgments, but these judgments are not performed in the script, but directly in the html code.
The basic structure of conditional comments is the same as HTML's comments (). So browsers other than IE will treat them as normal comments and ignore them completely.
IE will determine whether to parse the content of the conditional comments in the same way as the normal page content based on the if condition.
Conditional comments use the annotation structure of HTML, so they can only be used in HTML files, not in CSS files.
Syntactically, this is a fairly legitimate ordinary HTML comment. Any browser will think that the part in between is a comment and ignore it. But IE will also see [if IE] > and begin to interpret the next code until it encounters
/ if the IE version is greater than 5.5 / / if the IE version is less than or equal to 6 / / if the browser is not IE /
Although it seems to be more time-consuming when you use conditional comments for the first time, you will find it very convenient when you debug your CSS later. With conditional comments you only need to write HTML comments once, while with bug you need to write long, ugly code for each rule, and often hacks to change other hacks. Otherwise, conditional comments are legal HTML comments for any browser that does not support it. Here are some differences between conditional comments and CSS hacks:
Hacks is a browser-based bug, and these bug may eventually be fixed.
Conditional comments are based on IE-specific code, and this recognition mechanism will not be removed at any time.
Every browser can see your hacks, maybe the next version or a new browser will make an error in your hacks code.
Only IE can see conditional comments and affect the page with additional "IE files" that other browsers will not download at all.
Hacks cannot guarantee which browsers work and which are not, and the more hacks you use, the more cluttered the code will be.
Conditional comments use version matching to make it easy for authors to write code for specific versions.
On how to use conditional comments to determine that the IE browser version is suitable for IE5.0 and above, so much for sharing here. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 222
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.