Posted By

eugegim on 12/05/08


Tagged

css textmate center align horizontal vertical


Versions (?)

Who likes this?

19 people have marked this snippet as a favorite

robe
basicmagic
rickfu
ETbyrne
dsquare
garretjames
Bluewall
tewoos
Nix
AshMan
tmbrenneke
SystemR
colingardom
amasters
laurasilvani1981
charlesp1138
macrane9
wirenaught
lionminister


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  

You need to login to post a comment.