Answers for "vertically and horizontally center image in div"

0

center an image horizontally and vertically

.center{
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}
Posted by: Guest on May-03-2020
7

centre align image in div

body {
  margin: 0;
}

#over img {
  margin-left: auto;
  margin-right: auto;
  display: block;
}
Posted by: Guest on November-06-2020

Code answers related to "vertically and horizontally center image in div"

Browse Popular Code Answers by Language