Return to Snippet

Revision: 61033
at November 23, 2012 14:56 by Gianino


Updated Code
/*CSS background-image Technique*/
html { 
   width:100%; 
   height:100%; 
   background:url(logo.png) center center no-repeat;
}

/*CSS + Inline Image Technique*/
img {
   position: absolute;
   top: 50%;
   left: 50%;
   width: 500px;
   height: 500px;
   margin-top: -250px; /* Half the height */
   margin-left: -250px; /* Half the width */
}

Revision: 61032
at November 23, 2012 14:54 by Gianino


Initial Code
html { 
   width:100%; 
   height:100%; 
   background:url(logo.png) center center no-repeat;
}

img {
   position: absolute;
   top: 50%;
   left: 50%;
   width: 500px;
   height: 500px;
   margin-top: -250px; /* Half the height */
   margin-left: -250px; /* Half the width */
}

Initial URL
http://css-tricks.com/snippets/css/absolute-center-vertical-horizontal-an-image/

Initial Description
From css-tricks.com

Initial Title
Absolute Center (Vertical & Horizontal) an Image

Initial Tags
image, center

Initial Language
CSS