作者eight0 ( )
看板Web_Design
标题Re: [问题] 上下置中
时间Fri Aug 22 20:25:55 2014
※ 引述《yshlptt (小y)》之铭言:
: 一、使用绝对位置定位
: 把 container 元素设为 position: relative(或依需求设定 absolute)
: ...
这个真炫,我也是第一次看到。以前也有种常见的做法是把 parent 设成
relative,child 设 absolute,加上 top 与 margin-top 调位置。
http://jsbin.com/notifucigedo/7/edit?html,css,output
缺点是要知道 child 的高度。
这个方法好像是之前在板上看到的,用空的行区块原素设 height: 100% 来填满高度。
http://jsbin.com/peqilugomemi/1/edit?html,css,output
缺点就是要处理空白符,网路上也满多讨论
http://css-tricks.com/fighting-the-space-between-inline-block-elements/
个人觉得目前最好的做法还是 display: table-cell,和 Bootstrap 的
Grid system 也能很好的配合。
--
(* ̄▽ ̄)/‧★*"`'*-.,_,.-*'`"*-.,_☆,.-*`
http://i.imgur.com/oAd97.png
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.43.121.28
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Web_Design/M.1408710368.A.C8C.html