[問題] 如何將float div內的元素置中

作者: articulation (...)   2017-08-13 22:21:36
大家好
想請問有一個css float為left的父元素div,在不知道其高度的情況下
有辦法將裡面的元素(比如說是p或是form)垂直水平置中嗎
有爬過相關文章,但是是在知道父元素高度的情況下
例如這篇
https://stackoverflow.com/questions/12168145/vertically-center-content-of-floating-div
那在不知道高度的情況下,是不是就無法將裡面的元素垂直水平置中了呢@@
謝謝
作者: ssadd502227 (我想考試)   2017-08-14 00:13:00
改inlineblock align cnter最快
作者: xdraculax (首席怪叔叔)   2017-08-14 11:55:00
flex
作者: s25g5d4 (function(){})()   2017-08-14 20:55:00
display: flex然後看情況設定 align-content / align-item / justify-content 成 center^^^^ items 更正
作者: aspdoctor (大崎)   2017-08-15 23:52:00
Child {top: 50%; transform: translateY(-50%);}
作者: articulation (...)   2017-08-20 20:26:00
謝謝樓上大大們的建議

Links booklink

Contact Us: admin [ a t ] ucptt.com