The object-position
property, used in conjunction with object-fit
, designates how an <img>
or <video>
is positioned via x/y coordinates within its own content box.
The object-position
value can be a string (left, center, or right) or a number (in px or percentage).
img.ex {
height: 400px;
object-fit: none;
object-position: 50% top;
width: 600px;
}
position
Designates the position of an image or video within its own content box, with the first value controlling the x-axis and the second value controlling the y-axis. Only positive values are allowed.
initial
Sets the property to its default value.
inherit
Inherits this property’s value from its parent item.
Have a code example of object-position
? Submit a codepen.io demo and we'll showcase it here ↴