When the height attribute of Text is defined, the text entered in Text is not vertically centered, but it can be controlled through CSS. There is a good example below, you can refer to it.
When the height attribute of Text is defined, the text entered in Text is not vertically centered. However, you can add CSS to control it so that the entered text is vertically centered to make the web page more perfect.
The code is as follows:
<html> <head> <style type="text/css"> #text { height:20px; vertical-align:middle; line-height:20px; /*line-height must be equal to height*/ } </style> </head> <body> <table> <input type="text" id="text"> </table> </body> </html>
After adding the two attributes verticla-align and line-height, the text in the text box will be vertically centered in the text box. To Note that line-height must be equal to height.
For more detailed information on controlling the vertical centering of text in HTML text boxes through css, please pay attention to the PHP Chinese website!