Log in

View Full Version : vertical align the text within a text box



ismailc
02-04-2008, 01:39 PM
Hi, I need help please!

I want to vertical align the text within a text box.

I can set the vertical align of the text box but not the text.

My text box has a style property of: style ="height : 20px; border : 1px solid #CCCCCC;"

but my text is to high on top in the text box


I tried the following:
text-align : center; - but that moves the text to the center horizontally
vertical-align : sub;

Please Asist!


Regards

Medyman
02-04-2008, 01:45 PM
So you want to add a buffer between the text and the border?

Try
padding: 10px 10px 10px 10px

Like the name implies, it'll add padding around the border of the div. The syntax is as such: top padding, right padding, bottom padding, left padding.


HTH

BLiZZaRD
02-04-2008, 01:50 PM
vertical-align: only helps if you have something to align it too.. like a picture or a button.

If it is small text you can just adjust the line height, or you can use percentages or margins.

For more info and examples see this page (http://www.student.oulu.fi/~laurirai/www/css/middle/)

ismailc
02-04-2008, 01:58 PM
Hi, Thank You very much for the speedy response & help

padding-top : 2px;

Thank You

Regards