Previous Message
Next Message

What's the proper way to vertically center an element within its parent?

Sent by David Hucklesby on 4 March 2007 06:06


On Fri, 02 Mar 2007 15:03:01 -0800, Chris Chen wrote:
> Hi,
>
> I can't seem to be able to style <a> inside <span> to make it centered *vertically*
> inside <span>.
>
> <span class="span_link"><a href="http://www.msn.com" >Hello</a></span>
>
On Sat, 3 Mar 2007 12:31:04 -0800, Ed Seehouse replied:

> Whatever reason is the span there for?  There's nothing you can do with that
> construction that you can't do with just the link. 
> 
To add to that, if you want to adjust the vertical alignment within a block of text,
then you are on the right track with vertical-align (CSS property). Try using
a percentage instead of one of the keywords, and see if you can get the effect
you want. You can also use negative percents to drop it below the baseline.

Won't work in IE less than version 6, though. (Or any IE in quirks mode.)

Cordially,
David
--
www.hucklesby.com



______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: