evilguru
03-17-2005, 04:14 PM
Hi, I am currently making an office 2003 style css menu for a project and have a problem with the image vertical alignment. You can see what I mean here:
http://www.dcrez.co.uk/create/menu/test.htm
Here is the code for it:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Test</title>
<style type="text/css">
a:link{
padding: 1px;
text-decoration: none;
font-family: tahoma;
font-size: 10.5pt;
color: #000000;
display: block;
width: 165px;
height: 50px;
}
a:hover{
display: block;
background: rgb(255,238,194);
text-dcoration: none;
border: solid 1px rgb(00,045,150);
width: 165px;
font-family: tahoma;
font-size: 10.5pt;
color: black;
padding: 0px;
}
a:visited{
text-decoration: none;
font-family: tahoma;
font-size: 10.5pt;
color: black;
}
td,td.2,td.3{
vertical-align: text-middle;
background-image:
url('vertical%20tab.png');
background-repeat: repeat-y;
border-color: rgb(000,045,150);
border-style: solid;
border-width: 1px;
height: 25px;
width: 165px;
background-color: rgb(246,246,246);
line-height: 50px;
}
td{
border-top-width: 0px;
border-bottom-width: 0px;
}
td.2{
border-top-width: 1px;
border-bottom-width: 0px;
}
td.3{
border-top-width: 0px;
border-bottom-width: 1px;
}
img{
vertical-align: text-middle;
border-width: 0px;
}
</style>
</head>
<body>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="2">
<a href=""><img src="any.gif"> New Mail</a>
</td>
</tr>
<tr>
<td>
<a href=""><img src="any.gif"> Test</a>
</td>
</tr>
<tr>
<td class="3">
<a href="">Link</a>
</td>
</tr>
</table>
</body>
</html>
If you take a look at the page you will see that the buttons which have images, are top aligned (with the images being middle aligned to the text) while the buttons without images are middle aligned. Now, I have made the line spacing and the height of the link bigger, to make the problem easier to see. Currently I have only tested the menu in ie, but it should work in firefox. Does anyone know how I can get the whole link (text and images) to be middle vertically aligned?
Thanks for any help. :)
http://www.dcrez.co.uk/create/menu/test.htm
Here is the code for it:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Test</title>
<style type="text/css">
a:link{
padding: 1px;
text-decoration: none;
font-family: tahoma;
font-size: 10.5pt;
color: #000000;
display: block;
width: 165px;
height: 50px;
}
a:hover{
display: block;
background: rgb(255,238,194);
text-dcoration: none;
border: solid 1px rgb(00,045,150);
width: 165px;
font-family: tahoma;
font-size: 10.5pt;
color: black;
padding: 0px;
}
a:visited{
text-decoration: none;
font-family: tahoma;
font-size: 10.5pt;
color: black;
}
td,td.2,td.3{
vertical-align: text-middle;
background-image:
url('vertical%20tab.png');
background-repeat: repeat-y;
border-color: rgb(000,045,150);
border-style: solid;
border-width: 1px;
height: 25px;
width: 165px;
background-color: rgb(246,246,246);
line-height: 50px;
}
td{
border-top-width: 0px;
border-bottom-width: 0px;
}
td.2{
border-top-width: 1px;
border-bottom-width: 0px;
}
td.3{
border-top-width: 0px;
border-bottom-width: 1px;
}
img{
vertical-align: text-middle;
border-width: 0px;
}
</style>
</head>
<body>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="2">
<a href=""><img src="any.gif"> New Mail</a>
</td>
</tr>
<tr>
<td>
<a href=""><img src="any.gif"> Test</a>
</td>
</tr>
<tr>
<td class="3">
<a href="">Link</a>
</td>
</tr>
</table>
</body>
</html>
If you take a look at the page you will see that the buttons which have images, are top aligned (with the images being middle aligned to the text) while the buttons without images are middle aligned. Now, I have made the line spacing and the height of the link bigger, to make the problem easier to see. Currently I have only tested the menu in ie, but it should work in firefox. Does anyone know how I can get the whole link (text and images) to be middle vertically aligned?
Thanks for any help. :)