Complete Centered DIV (horizontal AND vertical alignment)

/ Published in: CSS
Save to your folder(s)

Copy this code and paste it in your HTML
  1. .vertical {
  2. width: 600px; /*--Specify Width--*/
  3. height: 300px; /*--Specify Height--*/
  4. position: absolute; /*--Set positioning to absolute--*/
  5. top: 50%; /*--Set top coordinate to 50%--*/
  6. left: 50%; /*--Set left coordinate to 50%--*/
  7. margin: -150px 0 0 -300px; /*--Set negative top/left margin--*/
  8. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.