47 lines
1.4 KiB
HTML
47 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<title>object-position on images</title>
|
|
<style type="text/css">
|
|
img, embed, object, input, canvas, video {
|
|
width: 100px;
|
|
height: 100px;
|
|
margin: 2px 10px;
|
|
border: 1px solid black;
|
|
background-color: gray;
|
|
}
|
|
|
|
.contain > img { object-fit: contain; }
|
|
.fill > img { object-fit: fill; }
|
|
|
|
.group > *:nth-child(1) { object-position: center center; }
|
|
.group > *:nth-child(2) { object-position: 20px 10px; }
|
|
.group > *:nth-child(3) { object-position: 50% 25%; }
|
|
.group > *:nth-child(4) { object-position: bottom 10px right 10px; }
|
|
.group > *:nth-child(5) { object-position: bottom 10% right 30%; }
|
|
|
|
.group > *:nth-child(7) { }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="contain group">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
</div>
|
|
|
|
<div class="fill group">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
<img src="../resources/circles-landscape.png">
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|