Key: The text should be included in the label Label and set the line height. Otherwise, the text will match the top of the text box
End alignment. Set vertical-align: middle in the text box; otherwise
Qi. The text in the button is vertically centered. You must set the height to the line height, and the line height to be smaller than the height.
<HTML>
<Head>
<Style type = 'text/CSS '>
Label
{
Line-Height: 20px;
Height: 20px
}
. Button
{
Font-size: 12px;
Text-align: center;
Padding: 0px;
Vertical-align: middle;
Line-Height: 22px;
Margin: 0px;
Height: 26px;
Width: 60px;
}
. Txt
{
Border: 1px # 6699cc solid;
Height: 20px;
Width: 160px;
Margin: 0px;
Vertical-align: middle;
Font-size: 12px;
Padding: 0px 2px;
Line-Height: 16px;
}
</Style>
</Head>
<Body>
Div text, text box, button vertical center Alignment Method and CSS style.
<Div class = "divpad" style = "font-size: 12px; Height: 28px;">
<Label> query: company name </label> <input id = "txt_company"
Type = "text" class = "TXT"/>
& Nbsp; <label> name </label> <input id = "txt_name"
Class = "TXT" width = "80px" type = "text"/>
& Nbsp; <input type = "button" id = "button1" value = "Search"
Class = "button"/> </div>
</Body>
</Html>