On 2008-09-19, Patrick <moi@ici.lawrote:
Quote:
Le 19.09.2008 22:34, Ben C a écrit :
Quote:
>On 2008-09-19, Patrick <moi@ici.lawrote:
Quote:
>>Hello,
>>>
>>I'm trying to align a text vertically in a link displayed as a block.
>>But the text is always at top.
>>Is there a solution?
>>
>Just remove height: 100% from the A and it will be vertically centered
>in the table cell.
>
Yes but I want the whole block to be clickable as a link, from the top
to the bottom of the screen.
>
Other ideas please?
It's not easy.
You could set a big line-height on the A (and no need to set
vertical-align: middle).
But you can't do that because you want "100%", not some known value, and
line-height: 100% doesn't mean 100% of the containing height but 100% of
the font size.
Display: table-cell on the A is another option, but won't work in IE.
You could put a span inside the A and offset it with position: relative
and top: 50%, but it won't be quite centered unless you move it up again
by half its font-size.
You could fake it with Javascript-- centre the A but give the table cell
a click handler.