Websites, SEO and web management, London UK.

SEO

Horizontal vertical alignment center

Horizontal align can be done simply. Element has to have a fixed width and no floating applied. Width auto or 100% doesn't work here.

	margin:0 auto;
	width:400px;

Sometimes you may need more complex horisontal alignment. Say to position a splash in the center of screen. Then you pair horisontal alignment with vertical alignment and you get "Horizontal Vertical Alignment Center". Without the margin-left and the fixed width here, the element would position itself by it's left-top corner.

	height:auto;
	left:50%;
	margin-left:-200px;
	position:absolute;
	top:30%;
	width:400px;
2010.

Web Development - XHTML CSS JavaScript jQuery.