Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
-->
<html>
<head>
<meta charset="utf-8">
<title>CSS Test: 'object-fit: contain' and 'contain: size' on img element, embedding a PNG image</title>
<link rel="author" title="Eric Portis" href="mailto:e@ericportis.com">
<link rel="match" href="object-fit-containsize-png-001-ref.tentative.html">
<style type="text/css">
img {
border: 1px dashed gray;
padding: 1px;
image-rendering: pixelated;
float: left;
contain: size;
object-position: top left;
}
br {
clear: both;
}
.big {
width: 32px;
height: 48px;
}
.small {
width: 8px;
height: 8px;
}
.cover { object-fit: cover }
.contain { object-fit: contain }
.fill { object-fit: fill }
.none { object-fit: none }
.scaledown { object-fit: scale-down }
</style>
</head>
<body>
<!-- big: -->
<img src="support/colors-16x8.png" class="big cover">
<img src="support/colors-16x8.png" class="big contain">
<img src="support/colors-16x8.png" class="big fill">
<img src="support/colors-16x8.png" class="big none">
<img src="support/colors-16x8.png" class="big scaledown">
<br>
<!-- small: -->
<img src="support/colors-16x8.png" class="small cover">
<img src="support/colors-16x8.png" class="small contain">
<img src="support/colors-16x8.png" class="small fill">
<img src="support/colors-16x8.png" class="small none">
<img src="support/colors-16x8.png" class="small scaledown">
<br>
</body>
</html>