object-position Property in CSS

CSSWeb DevelopmentFront End Technology

The object-position property is used to specify whether how we should position image or video inside its own box.

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
img.demo {
   width: 200px;
   height: 200px;
   object-fit: none;
   object-position: 10px 20%;
   border: 2px dashed yellow;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<img class="demo" src="https://www.tutorialspoint.com/memcached/images/memcached-mini-logo.jpg" alt="Memcached" width="400" height="250">
<h2>Memcached Tutorial</h2>
<img src="https://www.tutorialspoint.com/memcached/images/memcached-mini-logo.jpg" alt="Memcached" width="300" height="250">
</body>
</html>

Output

raja
Published on 26-Dec-2019 11:06:00
Advertisements