Declare the a
element as display: inline-block
and drop the width and height from the li
element.
Alternatively, apply a float: left
to the li
element and use display: block
on the a
element. This is a bit more cross browser compatible, as display: inline-block
is not supported in Firefox <= 2 for example.
The first method allows you to have a dynamically centered list if you give the ul
element a width of 100% (so that it spans from left to right edge) and then apply text-align: center
.
Use line-height
to control the text's Y-position inside the element.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…