Answers for "how to ensure that all photos fit into a div"

3

image to fill div

.fill {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden
}
.fill img {
    flex-shrink: 0;
    min-width: 100%;
    min-height: 100%
}
Posted by: Guest on March-21-2021
2

css resize image to fit div no stretching

.div {
  background-image: url(../images/your-image.png);
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
}
Posted by: Guest on October-06-2020

Code answers related to "how to ensure that all photos fit into a div"

Browse Popular Code Answers by Language