The parent element percentage line-height sets the text to the center

When the parent element sets the height as a percentage, the value of line-height cannot be a fixed value and cannot use an absolute px value, but set a percentage for line-height. In fact, this percentage is calculated according to the font size, and it is still impossible to obtain There are two solutions:
1. Set display:flex;align-items:center;justify-content:center;
for the parent element; 2. Set the displa for the parent element : table; the element that needs to be centered is set display:table-cell; vertical-align:middle;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324841194&siteId=291194637