How to vertically align text inside a flexbox?

前端 未结 10 1700
不知归路
不知归路 2020-11-22 09:24

I would like to use flexbox to vertically align some content inside an

  • but not having great success.

    I\'ve checked online and many of the tut

  • 10条回答
    •  南旧
      南旧 (楼主)
      2020-11-22 10:20

      The most voted answer is for solving this specific problem posted by OP, where the content (text) was being wrapped inside an inline-block element. Some cases may be about centering a normal element vertically inside a container, which also applied in my case, so for that all you need is:

      align-self: center;
      

    提交回复
    热议问题