Andrew Pallant

Software and Web Developer

HTML Centering DIV Tag ( DIV Element )

Published: Dec 30, 2009 00:44:00
Physical Link: HTML Centering DIV Tag ( DIV Element )


The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following.

style=’padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;’

Sample Image


Posted in Uncategorized