CSS Center DIV on absolute position


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



Copy this code and paste it in your HTML
  1. #container {
  2. width: 140px;
  3. border: 1px solid #666666;
  4. position: absolute;
  5. top: 0px;
  6. left: 50%;
  7. margin-left: -70px; /* width/2 */
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.