IE7: <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
Transitional. dtd ">
<Html>
<Head>
<Meta http-equiv = "X-UA-Compatible" content = "IE = EmulateIE7"/>
<Title> </title>
</Head>
<Body>
<Div style = "width: 600px; height: 300px; background-color: Black; float: left;"> </div>
<Div style = "width: 600px; height: 300px; background-color: Yellow; float: right;"> </div>
<Div style = "background-color: Green; height: 100px;"> aa </div> <! -- In IE7, The div is not hidden below the floating element.
The clear floating element is a placeholder for the div -->
<Table style = "background-color: Red; height: 10px; width: 10px;"> <! -- Floating elements in IE7 hold a placeholder for the table -->
<Tr>
<Td>
</Td>
</Tr>
</Table>
<Span style = "clear: both;"> <! -- Non-block-level elements in IE7 can clear floating -->
456
</Span>
</Body>
</Html>
FireFox/IE8 <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
Transitional. dtd ">
<Html>
<Head>
<Meta http-equiv = "X-UA-Compatible" content = "IE = EmulateIE8"/>
<Title> </title>
</Head>
<Body>
<Div style = "width: 600px; height: 300px; background-color: Black; float: left;"> </div>
<Div style = "width: 600px; height: 300px; background-color: Yellow; float: right;"> </div>
<Div style = "background-color: Green; height: 100px;"> aa </div> <! -- In IE8, The div is hidden below the floating element, indicating that the floating Element
Div is not placeholder, But aa is crowded in the middle. It indicates that floating elements must be placeholder for non-block-level elements in div -->
<Table style = "background-color: Red; height: 10px; width: 10px;"> <! -- Floating elements in IE8 occupy space on the table, which is better indicated in IE8 and
Floating elements in FireFox are not placeholder only for div -->
<Tr>
<Td>
</Td>
</Tr>
</Table>
<Span style = "clear: both;"> <! -- Float cannot be cleared for non-block-level elements in IE8 -->
456
</Span>
<P style = "clear: both;"> <! -- In IE8, block-level elements can be cleared. -->
789
</P>
</Body>
</Html>
Note the following:
The display: inline of div disappears completely.
In IE and FireFox: <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
Transitional. dtd ">
<Html>
<Head>
<Meta http-equiv = "X-UA-Compatible" content = "IE = EmulateIE8"/>
<Title> </title>
</Head>
<Body>
<Div style = "background-color: Maroon; width: 60px; height: 60px; float: left;">
</Div> <! -- Floating elements reduce part of the block-level elements that follow them. For example, table t1 is a block-level element, after div float, t1 is not full on the right side of div, but only full on the right side of div -->
<Table id = "t1" style = "background-color: Green; width: 60px; height: 60px;">
<Tr>
<Td>
</Td>
</Tr>
</Table>
Row 2
</Body>
</Html>