解决浮动元素父容器高度自适应问题
<!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> <title>clearfix</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta http-equiv="Content-Language" content="zh-CN" /> <style type="text/css"> .area{background:#ccc;width:960px;}/*定义父容器背景颜色,以便于观察;定义宽度,使其在IE下高度自适应*/ .clearfix:after{height:0px;visibility:hidden;content:".";clear:both;display:block;} .fl{float:left;background:#FFDF00;} </style> </head> <body> <div class="area clearfix"> <div class="fl">floater</div> </div> </body> </html>
相关推荐
yangkang 2020-11-09
alien 2020-11-15
ChlatZed 2020-11-11
远远的山 2020-11-09
xysoul 2020-11-03
onepiecedn 2020-10-29
lnkToKing 2020-10-29
ChlatZed 2020-10-27
谢恩铭 2020-10-23
yuanye0 2020-10-15
liverlife 2020-10-10
somyjun 2020-09-29
xiaoying 2020-09-28
kunyus 2020-09-25
dusuanyun 2020-09-21
newisI 2020-09-01
afanti 2020-09-14