Take note when using https://css-tricks.com/centering-css-complete-guide/
- Vertically
- Is it inline or inline-* elements (like text or links)?
- Is it a single line?
- don't know height of element:
padding-top
==padding-bottom
- know height of element: using
line-height
.center-text-trick { height: 100px; /* apply inline-block element, inline element doesn't need it */ line-height: 100px; white-space: nowrap; /* don't break line */ }
- don't know height of element:
- Is it a single line?
- Is it inline or inline-* elements (like text or links)?
Ref:
- https://css-tricks.com/almanac/properties/v/vertical-align/
vertical-align
suite forimg
&table-cell
- https://css-tricks.com/what-is-vertical-align/
vertical-align
suite forimg
&table-cell
- http://christopheraue.net/2014/03/05/vertical-align/ very details, read it if you want to know
base-line
,line-height
- https://css-tricks.com/centering-in-the-unknown/ ghost element technique