Log in

View Full Version : align text in middle of menu



geoffb
10-01-2006, 07:02 AM
Hi all,

I have some navigation menus that are about 40px in height.

i want to get the text for the buttons in the very center of them, when i do text-align: center; on my css it keeps them up by the top of the button and in the center, but i want it in the middle from top to bottom too.

Help please

geoffb

jscheuer1
10-01-2006, 09:22 AM
You want vertical-align:middle; but, that generally only works in table cells. If you are using div elements, you can do something like so:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.menudiv {
width:10em;
height:2em;
padding-top:0.75em;
text-align:center;
border:1px solid black;
}
</style>
</head>
<body>
<div class="menudiv">Some Text</div>
</body>
</html>