码迷,mamicode.com
首页 > 其他好文 > 详细

使用 :after伪元素撑开 div

时间:2015-05-03 23:28:00      阅读:786      评论:0      收藏:0      [点我收藏+]

标签:

使用 :after伪元素撑开 div,

<html>
<head><style type="text/css">
    .clearfix:after {
        content: ".";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;
    }
</style>
</head>
<body>
    <div class="clearfix" style="padding:1px 1px 1px 1px; border: 1px solid red; width:200px;">
        <div style="float:left;width:80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;width:80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;width:80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;width:80px;height:80px;border:1px solid blue;">TEST DIV</div>
        <div style="float:left;width:80px;height:80px;border:1px solid blue;">TEST DIV</div>
    </div>
</body>
</html>

TEST DIV

TEST DIV

TEST DIV

使用 :after伪元素撑开 div

标签:

原文地址:http://www.cnblogs.com/npk19195global/p/4474914.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!