日期:2014-05-17 浏览次数:20820 次
例如:
<!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>无标题文档</title> <style> .clear{zoom:1;} .clear:after {display:block; clear:both; content:" "; visibility:hidden; height:0; line-height:0;} </style> </head> <body> <div style=" border:1px solid #6F0;" class="clear"> <div style="float:left; background:#000; width:50px; height:50px;"></div> <div style="float:left; background:#00C; width:50px; height:50px;"></div> <div style="float:left; background:#900; width:50px; height:50px;"></div> </div> </body> </html>
CSS 样式部分注意:
?
.clear{zoom:1;}
.clear:after {display:block; clear:both; content:" "; visibility:hidden; height:0; line-height:0;}