作者articulation (...)
看板Web_Design
標題[問題] 如何將float div內的元素置中
時間Sun Aug 13 22:21:36 2017
大家好
想請問有一個css float為left的父元素div,在不知道其高度的情況下
有辦法將裡面的元素(比如說是p或是form)垂直水平置中嗎
有爬過相關文章,但是是在知道父元素高度的情況下
例如這篇
https://stackoverflow.com/questions/12168145/vertically-center-content-of-floating-div
那在不知道高度的情況下,是不是就無法將裡面的元素垂直水平置中了呢@@
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 106.105.118.93
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Web_Design/M.1502634100.A.FE0.html
1F:推 ssadd502227: 改inlineblock align cnter最快 08/14 00:13
2F:→ xdraculax: flex 08/14 11:55
3F:推 s25g5d4: display: flex 08/14 20:55
4F:→ s25g5d4: 然後看情況設定 align-content / align-item / justify- 08/14 20:55
5F:→ s25g5d4: content 成 center 08/14 20:55
6F:→ s25g5d4: ^^^^ items 更正 08/14 20:56
7F:推 aspdoctor: Child {top: 50%; transform: translateY(-50%);} 08/15 23:52
8F:→ articulation: 謝謝樓上大大們的建議 08/20 20:26
※ 編輯: articulation (106.105.118.25), 08/20/2017 20:54:22
10F:→ articulation: yabichiku大大的幫忙 08/31 13:42