I don't want to set a fixed Px, because it will change. How to set it to follow 100% of the element height?
vertical- align:middle;display :inline-block;
If you just want to center the text vertically, you can use display:table-cell; Or flex
If you don't mind the amount of code, you can center it by positioning, which is not recommended. Flex is recommended
Add pseudo class, 100% height. Then modify the horizontal center.
It's like this
line-height:calc(100% - 0px);