Answers for "css background object fit"

9

css background image fit

body {
    background-image:    url(images/background.svg);
    background-size:     cover;                      /* <------ */
    background-repeat:   no-repeat;
    background-position: center center;              /* optional, center the image */
}
Posted by: Guest on April-24-2020
2

is there an img cover

body {
  margin: 0;
}
img {
  display: block;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
}
Posted by: Guest on February-26-2020
1

how to contain image size

overflow: 'hidden',
backgroundSize : 'contain',
Posted by: Guest on May-26-2020

Browse Popular Code Answers by Language