dead center a div - short version


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

225 is half the height, 350 is half the width


Copy this code and paste it in your HTML
  1. #deadCenter {
  2. width: 700px;
  3. height: 450px;
  4.  
  5. margin: -225px 0 0 -350px; /* 225 is half the height, 350 is half the width */
  6. position: absolute;
  7. top: 50%;
  8. left: 50%;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.