Posted By

eugegim on 12/05/08


Tagged

css textmate center


Versions (?)

Last Edited at 12/05/08 12:28am

Viewed 7 times

CSS Horizontally and Vertically Center Element


/ Published in: CSS

URL: http://www.dezinerfolio.com/2007/05/02/the-simplest-way-to-horizontally-and-vertically-center-a-div/


  1. /* This will horizontally and vertically center an element, but
  2.   requires that the height and width of it are known */
  3. .centered
  4. {
  5. width:16px;
  6. height:16px;
  7. position:absolute;
  8. top:50%;
  9. left:50%;
  10. margin-left:-8px;
  11. margin-top:-8px;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.