Display inline block text inside issue

后端 未结 3 808
野的像风
野的像风 2021-01-16 21:05

I have been trying out display inline-block, everything worked out great if I didn\'t add anything into the divs but when I do the div collapsed and I don\'t know exactly wh

3条回答
  •  一向
    一向 (楼主)
    2021-01-16 21:26

    The issue is due to default vertical alignment of inline elements – baseline, the text inside element affects it and pushes div to the bottom. Use vertical-align: top, for example, to suppress this behavior.

    JSFiddle

提交回复
热议问题