Let’s look at an example first Copy code The code is as follows:<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ /> <title>Untitled Document</title> <style> #m{height:300px;width:300px;background:#ccc} #a{float:left;height:100px;width:100px;background:#f00;} #b{float:left;height:100px;*height:110px;_height:120px;width:100px;background:#0f0;} #c{clear:both;height:100px;width:100px;*width:100px;_width:120px;background:#00f;} </style> </head> <body> <div id=”m”> <div id="a"></div> <div id="b"></div> <div id="c"></div> </div> </body> </html> Here, I define three heights respectively. The first normal definition will take effect in all browsers; The second definition adds an asterisk in front, which will be recognized as the height attribute in IE6 and IE7, but Firefox and IE8 will think it is a syntax error and ignore it. According to the order of execution, the height with an asterisk is executed in IE6 and IE7, and the first normal height is invalid (or overwritten); The third height has an underscore in front. Only IE6 considers the underscore as a valid height attribute, while IE7, IE8 and Firefox regard the "_height" attribute as a non-existent attribute and therefore do not execute it, while IE6 executes it. In this way, the first two heights are covered by the underlined height in IE6. Well, through this example, you should understand that if we want to set different heights of an element in different browsers, we can use the * and _ symbols to assist in the definition. At the same time, we also learned that Microsoft is a company with a high tolerance for mistakes! Haha. However, if the first two lines of document type and namespace declarations in this example are removed, the underlined height will also be displayed normally. The width settings are the same. In our actual work, we will often encounter different browser interpretations of margin attributes, then asterisks and underscores can be of great help. |
<<: A brief discussion on how Tomcat breaks the parent delegation mechanism
>>: Several ways to vertically and horizontally center in CSS3 with indefinite height and width
Start a new project This article mainly records t...
Table of contents 1. Introduction 1.1 Babel Trans...
1. Key points for early planning of VMware vSpher...
Introduction The mysql-utilities toolset is a col...
This article shares the specific code for JavaScr...
Using cutecom for serial communication in Ubuntu ...
Preface NFS (Network File System) means network f...
Mysql auto-increment primary key id does not incr...
In JavaScript's DOM event model, events are r...
This article shares the data display code for Jav...
<template> <div class="app-containe...
1. Create an empty directory $ cd /home/xm6f/dev ...
A simple license plate input component (vue) for ...
Some of you may have heard that the order of trav...
Preface: With the continuous development of Inter...