css object fit code example

Example 1: is there an img cover

body {
  margin: 0;
}
img {
  display: block;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
}

Example 2: how to contain image size

overflow: 'hidden',
backgroundSize : 'contain',

Example 3: onbject-fit css

The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.

Example 4: object-fit values in css

img{
  object-fit: cover|contain|fill|none|scale-down;
}

Example 5: object fit cover

img {
  width: 200px;
  height: 
  400px;
  object-fit: cover;
}

Tags:

C Example