PDA

View Full Version : vertical-align: middle doesn't work!



DanDude
November 14th, 2010, 01:13 PM
Hi!

This is my code:

div.subject {
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
margin-top: 10px;
margin-bottom: 10px;
font-family:"Helvetica", sans-serif;
width:150px;
height:40px;
color:#3dbeff;
background:#ffffff;
text-align: center;
vertical-align: middle;
cursor:pointer;
margin-left: auto;
margin-right: auto;
}Still, the text will not be vertically aligned. The div is inside a table, would that matter?

Thanks!
Dan

gmargo
November 14th, 2010, 05:49 PM
Not positive, but I think that vertical-align applies only to inline elements, but DIV is a block element.

http://htmlhelp.com/reference/css/text/vertical-align.html

Try applying vertical-align on the td cell element in the table.

DanDude
November 14th, 2010, 08:45 PM
Uhm, that won't work.
If I do so, all of the content inside the td will be centered, not the text inside every div...

Thanks!

DanDude
November 19th, 2010, 05:12 PM
Anyone?