Home >Web Front-end >HTML Tutorial >Summary of browser hacks Detailed browser compatibility solutions_html/css_WEB-ITnose

Summary of browser hacks Detailed browser compatibility solutions_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:58:551135browse

Because each browser parses the page differently, the style of the page displayed in different browsers will be inconsistent. In order to maintain the unity of the page, it is often necessary to debug browser compatibility issues.

CSS Hack

Faced with many browser compatibility issues, it is often necessary to debug through CSS styles, and the most commonly used one is CSS Hack. The so-called CSS Hack is to write different CSS styles for different browsers, and control the display effect of a certain browser by using the style code that is individually recognized by the browser. CSS Hacks are mainly divided into two categories

CSS Selector Hacks


CSS Selector Hack refers to adding in front of the CSS selector Use some Hack prefixes that only specific browsers can recognize to control different CSS styles. For different versions of browsers, selector Hacks are divided into the following categories:

(1) Selector Hacks recognized by IE6 and versions below IE6

When writing CSS styles, if you want this style It is only effective for browsers of IE6 and below. You can use the selector Hack of IE6 and below. The basic syntax is as follows:

* html selector {style code}


(2) Selector Hack recognized by IE7

When writing CSS styles, if you want this style to be effective only for IE7 browsers, you can use the selector Hack recognized by IE7. Its basic syntax is as follows:

* html selector {style code}


CSS Attribute Hack


Here, Teacher Xiaoqiang divides attribute hacks into prefix attribute hacks and Suffix attribute hack

CSS属性Hack(前缀) 针对的浏览器
_color:red; IE6及其以下的版本
*color:red ;或者  color:red; IE7及其以下的版本
CSS属性Hack(后缀) 针对的浏览器
color:red9; IE6/IE7/IE8/IE9/IE10版本
color:red
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn