how can i get vertical align?

G

Giorgio

Hi,
I use this code to extend <A> area to all the black cell, but i can't center
the links vertically.
Can you help me, please?

Thanks

<HTML>
<HEAD>
<TITLE></TITLE>

<style type="text/css">
<!--
td a {
display:block;
width:40px;
height: 40px;
background-color:#000000;
vertical-align: middle;
color: #ffffff;
text-align:center;
text-decoration:none;
font-family:verdana;
font-weight:bold;
}
td a:hover {
background: #80ff40;
color: #000000;
}
-->
</style>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD><A href="#">1</A></TD><TD><A href="#">2</A></TD><TD><A
href="#">3</A></TD>
</TR>
</TABLE>
</BODY></HTML>
 
J

Jonathan N. Little

Giorgio said:
Hi,
I use this code to extend <A> area to all the black cell, but i can't center
the links vertically.
Can you help me, please?

Thanks
<snip code>

the LINKS are vertically aligned within the table cells, see for
yourself by adding a border to the links:


td a {
display:block;
width:40px;
height: 40px;
line-height: 40px;
background-color:#000000;
vertical-align: middle;
color: #ffffff;
text-align:center;
text-decoration:none;
font-family:verdana;
font-weight:bold;
border: 1px solid red; /* add this */
}

now try this and see what one of your problems are...

td a {
display:block;
width:40px;
/* disable this 'height: 40px;' */
line-height: 40px; /* add this */
background-color:#000000;
vertical-align: middle;
color: #ffffff;
text-align:center;
text-decoration:none;
font-family:verdana;
font-weight:bold;
border: 1px solid red; /* add this */
}
 
G

Giorgio

sorry, bottom and left
it's weird cause if i stamp screen and zoom it, i can see that the border is
1 pixel everywhere but if i look it without zoom it seems that is larger in
the bottom and in the left side.
 
J

Jonathan N. Little

Giorgio said:
sorry, bottom and left
it's weird cause if i stamp screen and zoom it, i can see that the border is
1 pixel everywhere but if i look it without zoom it seems that is larger in
the bottom and in the left side.

Sounds like a video driver/monitor issue or possibly your browser's
rendering engine...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top