Sunday, August 23, 2020

CSS - inline-block vs table-cell

https://stackoverflow.com/questions/15939896/css-inline-block-vs-table-cell

https://jsfiddle.net/g5bE8/

Excerpt 1:

You'll also find the gap between block when you apply display: inline-block;  

Re-size your window by pressing Ctrl key and scrolling with mouse scroll button to see differences.

Notice the vertical-align: middle; is not working as display: table-cell; in display: inline-block;.

 Exceprt 2:

Set line-height equal to element height and vertical-align will work for inline-block.

No comments:

Post a Comment

Followers

Blog Archive