Tuesday, 15 March 2011

css - Vertically aligned anchor text -



css - Vertically aligned anchor text -

how can align text of anchor vertically?

i may or may not know number of lines, line-height trick can't relied upon.

hierarchy so: nav ul li a in <nav> <ul> <li><a href="#">hello</a></li> </ul> </nav>

hello must centered cannot wrapped.

the elements have display: inline-block

following solution explained in thread: how display:table-cell back upwards in ie? pure javascript or jquery workaround?

you can add together additional code list, , adjust height of block height of td:

<nav> <ul> <li> <table> <tr> <td> <a href="#">hello</a> </td> </tr> </table> </li> </ul> </nav>

you can see working here: http://jsfiddle.net/g4kcz/4/

css internet-explorer-7 vertical-alignment

No comments:

Post a Comment