1. When the line text is vertically centered
Set the height to equal to the row height.
For example:
<Ul>
<Li> <a href = "#" Title = "nav1" target = "_ Self"> nav1 </a> <li>
<Li> <a href = "#" Title = "nav2" target = "_ Self"> nav2 </a> </LI>
<Li> <a href = "#" Title = "nav3" target = "_ Self"> nav3 </a> </LI>
</Ul>
Set the Row Height and height of a to be equal.
2. Vertical center of multi-line text
<Div style = "padding: 10px 0;"> the content of the new Div label is displayed here </div>
Set the filling to be equal to upper and lower.
3. Vertical center of input text
<Style type = "text/CSS">
. Bg {
Background: URL (images/search_bg.gif) No-Repeat;
Font-size: 12px;
Padding: 8px 0;
Border: none;
Line-Height: 29px;
Color: # CCC;
_ Height: 29px;
_ Padding: 0;
}
</Style>
<Input name = "Search" type = "text" class = "BG" value = "Enter your keyword" size = "100"/>
Set the line height to the sum of the upper and lower fills and the text size. To be compatible with IE6, define the height for IE6 separately and remove the fill value.