“`” 参考回答:

法一:父元素display:flex,align-items:center;

法二:元素绝对定位,top:50%,margin-top:-(高度/2)

法三:高度不确定用transform:translateY(-50%)

法四:父元素table布局,子元素设置vertical-align:center;

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.