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

全兼容的多列均匀布局问题

时间:2016-10-20 11:53:22      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

html:

<
div class="container"> <div class="justify"> <i>1</i> <i>2</i> <i>3</i> <i>4</i> <i>5</i> </div> </div>
css:

.container
{ width:400px; margin:50px auto 0; background:#ddd; } .justify{ position:relative; width:100%; height:24px; text-align: justify; } .justify i{ width:24px; line-height:24px; display:inline-block; text-indent:9px; background:#333; color:white; border-radius:50%; overflow: hidden; font-style: normal; } .justify:after { content: ""; display: inline-block; position: relative; width: 100%; }

通过给伪元素 :after 设置 inline-block 设置宽度 100% ,配合容器的 text-align: justify 就可以轻松实现多列均匀布局了。

全兼容的多列均匀布局问题

标签:

原文地址:http://www.cnblogs.com/kerry-xu/p/5979967.html

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