Skip to content

Instantly share code, notes, and snippets.

@YangShunGit
Created February 26, 2022 03:16
Show Gist options
  • Save YangShunGit/6813dd4d4b4a1443194a42a5afa85922 to your computer and use it in GitHub Desktop.
Save YangShunGit/6813dd4d4b4a1443194a42a5afa85922 to your computer and use it in GitHub Desktop.
img或video设置100%仍不能铺满全屏时,需要设置object-fit属性

object-fit :CSS 属性指定可替换元素的内容应该如何适应到其使用的高度和宽度确定的框

.fill {
  object-fit: fill;
}

.contain {
  object-fit: contain;
}

.cover {
  object-fit: cover;
}

.none {
  object-fit: none;
}

.scale-down {
  object-fit: scale-down;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment