CSS: Why “vertical-align: middle” does not work?

前端 未结 8 1324
无人及你
无人及你 2021-02-13 06:24

Consider the following example: (live demo here)

HTML:



        
8条回答
  •  半阙折子戏
    2021-02-13 06:54

    If you know the vertical size of the element and the line height, then you can vertically center it by using vertical-align: top plus a top margin.

    For illustration, I created: http://jsfiddle.net/feklee/cXUnT/30/

提交回复
热议问题