Vertically center text using CSS
One of the big problems with using CSS is that there is no easy way to vertically center text in a <div>. I've seen various hacks using negative margins, but sometimes there is a much easier way using the "line-height" property.
NOTE: This only works if you know the height of the <div> and there is only one line of text.
Here is a typical <div> box:
.box {
height: 75px;
width: 100px;
border: 1px solid #666;
text-align: center;
}
It looks like this:

To vertically center the text, all we need to do is add a line-height value equal to the height of the box:
.box {
height: 75px;
line-height: 75px;
width: 100px;
border: 1px solid #666;
text-align: center;
}
Now the text is vertically centered:

This solution is certainly limited, but in certain situations it is very useful.
NOTE: This only works if you know the height of the <div> and there is only one line of text.
Here is a typical <div> box:
.box {
height: 75px;
width: 100px;
border: 1px solid #666;
text-align: center;
}
It looks like this:

To vertically center the text, all we need to do is add a line-height value equal to the height of the box:
.box {
height: 75px;
line-height: 75px;
width: 100px;
border: 1px solid #666;
text-align: center;
}
Now the text is vertically centered:

This solution is certainly limited, but in certain situations it is very useful.

I am tryig to vertically align text (to the right-bottom) Foll is the stylesheet
.author
{
background-image:url(Feather.jpg);
background-repeat: no-repeat;
background-attachment:fixed;
background-position: right bottom;
height:100px;
width:110px;
align:right;
vertical-align: bottom;
border:1px solid black;
}
and the HTML code is
<div class="author">by AUTHOR</div>
but somehow the text is not getting displayed at the right bottom postion of the div area
Can you please help me solve this problem
thank you
Deepa
The vertical-align property isn't what you think it is. It's more akin to the old "valign" property for <img> tags.
To place text at the bottom of an element using the line-height technique from this post, change the line-height to double the height of your element minus half the size of the font.
Line-height = 2 x div height - (font size/2)
So if you were using 12px text, your line-height would be:
2 x 100px - (12/2) = 194px;
The drawback to this solution (as well as my original post) is things get all out of whack when/if the user changes his font display size via his/her browser.