Absolute Center (Vertical & Horizontal) an Image

Submitted by:Jhon Smith

Date added:29 October, 2011

Category:CSS

Example shown here CSS + Inline Image Technique

Tags: center an image

Code Snippet:

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

Comments