Posted by Ben C on 06/12/07 21:33
On 2007-06-12, vunet.us@gmail.com <vunet.us@gmail.com> wrote:
> On Jun 12, 4:50 pm, Ben C <spams...@spam.eggs> wrote:
>> On 2007-06-12, vunet...@gmail.com <vunet...@gmail.com> wrote:
>>
>>
>>
>> > and text of a link is in the middle centered... thannks
>>
>> Set vertical-align: middle on the td.
>
> what if I set display:block; for A?
Yes you can do that but then it's going to be harder to get the text of
the link vertically centered.
If the text can be guaranteed to be all on one line you can set a
line-height on the <a> equal to the height you've set as well as setting
vertical-align: middle on it.
If you want text that breaks across lines but to have those lines
centered vertically in their container, you need a table-cell with
vertical-align: middle. Nothing else has quite the same behaviour. For
this reason it's desirable to keep your <a> inline and directly inside a
table cell.
You said you wanted your <a> width:100% and height:100% so it may well
be there's no point in making it display: block when it completely fills
the table cell anyway. Just decorate the table cell instead and leave
the <a> as inline.
[Back to original message]
|