This is a small example of Css floating property removal. Don't underestimate how to clear the floating. Sometimes, if you forget this, it will make you confused and think you have made a mistake elsewhere, there are actually no code to clear the float, But the importance cannot be ignored.
Instance code:
Copy to ClipboardReference: [www.bkjia.com] <! 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 = UTF-8"/>
<Title> css clear floating </title>
<Style>
. Float
{
Float: left;
Width: 200px;
Height: 100px;
Background: #666666;
}
. Clear
{
Clear: left;
Float: left;
Width: 200px;
Height: 100px;
Background: #999999;
}
</Style>
</Head>
<Body>
<Div class = "float"> This is a floating element </div>
<Div class = "clear"> This is an element that clears floating attributes </div>
</Body>
</Html>