ITPub博客

首页 > IT职业 > IT图书 > Css 清除浮动属性示例

Css 清除浮动属性示例

IT图书 作者:chunzhisu 时间:2014-07-16 11:19:39 0 删除 编辑

点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
  2.  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  3. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  4. <head>
  5. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
  6. <title>css清除浮动</title>
  7. <style>
  8. .float
  9. {
  10.   float:left;
  11.   width:200px;
  12.   height:100px;
  13.   background:#666666;
  14. }
  15. .clear
  16. {
  17.   clear:left;
  18.   float:left;
  19.   width:200px;
  20.   height:100px;
  21.   background:#999999;
  22. }
  23. </style>
  24. </head>
  25.  
  26. <body>
  27.   <div class=\"float\">这是一个浮动元素</div>
  28.   <div class=\"clear\">这是一个清除浮动属性的元素</div>
  29. </body>
  30. </html>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1220136/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122212