!important usage and performance under IE6:
!important can increase the priority of the specified CSS statement. To use it, add !important after the corresponding CSS statement. For example:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.51texiao.cn/" /><title>蚂蚁部落</title><style type="text/css">.mytest{ color:blue!important; color:red;}</style></head><body> <div class="mytest">蚂蚁部落</div></body></html>
Everyone knows that CSS styles have the "proximity principle", that is, styles defined later can override previous styles. If !important is not used in the above code, then The font color appears red.
Currently all mainstream browsers support !important, but it is not fully supported on IE6. Why is it said that it is not fully supported? Because it is supported in some cases and not supported in some cases. For example, in the above code, IE6 browser Not supported, the text will be rendered in red font. Let’s look at the following example:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.51texiao.cn/" /><title>蚂蚁部落</title><style type="text/css">.mytest{ color:blue!important;}.mytest{ color:red;}</style></head><body><div class="mytest">蚂蚁部落</div></body></html>
In the above code, you can see that the font color is displayed in blue, which means that if If the two pieces of code are used in the same curly bracket ({}), it will not work under IE6. If they are used separately in two curly brackets ({}), it will work.
The original address is: http://www.51texiao.cn/div_cssjiaocheng/2015/0501/500.html