Sunday 8 July 2012

Vertically aligning with CSS


Vertically aligning with CSS

Vertically aligning with tables was a doddle. To make cell content line up in the middle of a cell you would use


vertical-align: middle.

This doesn't really work with a CSS layout. Say you have a navigation menu item whose height is assigned 2em and you insert this vertical align command into the CSSrule. It basically won't make a difference and the text will be pushed to the top of the box.

Hmmm... not the desired effect. The solution? Specify the line height to be the same as the height of the box itself in the CSS. In this instance, the box is 2em high, so we would insert

 line-height: 2em

into the CSS rule and the text now floats in the middle of the box - perfect.



BUDDY CHECK OUT THESE ALSO : ALL LEARNING THING , HTML , CSS , WEB FORMS ,DREAM WEAVERDTD , JAVAJAVA SCRIPT , SQL , MY SQL  , PL-SQL , PHOTOSHOP , C + + , C  , WEB PAGES , MAYAPDF FILES , EVERYTHING AVAILABLE , AJAX  , HYBERNATE , WSDL  , WAP , RUBY ON RAILS , SCALA , HTTP , HTML 5 , PROTOTYPE , Wi-MAX , FLASH , WML , RUBY , PERL ,UNIX , DLL , RSS , RADIUS , UNIX SOCKET , PYTHON , JSP , SOAP , MVC , DOT NET , PHP , ADO , ASP , J QUERY , TCP/IP , VISUAL BASIC , UML , VISUAL STUDIO , GPRS....


No comments:

Post a Comment