Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

css horizontal and vertical center image in div

.center-img {
	margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}

// if that does not work you can try
.center-img {
	margin-left: auto;
	margin-bottom: auto;
	margin-top: auto;
	margin-right: auto;
}
 
PREVIOUS NEXT
Tagged: #css #horizontal #vertical #center #image #div
ADD COMMENT
Topic
Name
3+9 =