Problem description
---
In IE6 IE7 IE8 (Q), if the clear attribute is set on a floating element, the floating element is placed on the same line as the floating element in front of it.
In IE6 IE7 IE8 (Q), if the clear property is set to a floating element, the outer top edge of the floating element behind it is higher than the outer top edge of the element.
The impact of---
-
In IE6 IE7 IE8 (Q), the clear attribute is set on a floating element, causing the page layout to be garbled.
--The affected browser
-
IE6 IE7 IE8 (Q)
Problem analysis
For the above two problems, we use the following test cases to illustrate.
Analyze the following code:
<div id= "Container" style= "width:300px; height:200px; border:1px solid red; ">
<div id= "DIV1" style= "float:right; width:150px; height:50px; ">1 float:right;</div>
<div id= "DIV2" style= "clear:right; Float:right; width:250px; height:50px; ">2 Clear:right; Float:right;</div>
<div id= "DIV3" style= "float:left; width:100px; height:50px; ">3 float:left;</div>
/div>
Google and other effects are as follows
<div id= "Container" style= "width:300px; height:200px; border:1px solid red; ">
<div id= "DIV1" style= "float:right; width:150px; height:50px; ">1 float:right;</div>
<div id= "DIV2" style= "clear:right; Float:right; width:250px; height:50px; ">2 Clear:right; Float:right;</div>
<div id= "DIV3" style= "float:left; width:100px; height:50px; ">3 float:left;</div>
</div>
-----
Solution Solutions
---
Do not apply the ' clear ' attribute to floating elements in order to avoid the above incompatibility issues.
Compatibility Issue 2