Easy Tutorial
❮ Css3 Pr Target Css3 Pr Text Wrap ❯

CSS object-position Property

Example

Resize the image based on the container size and set its position:

img.a {
  width: 200px;
  height: 400px;
  object-fit: none;
  object-position: 5px 10%;
  border: 5px solid red;
}

Definition and Usage

The object-position property is typically used in conjunction with object-fit to set the position of the element.

object-position is commonly used with img and video tags.

Inherited: Yes.
Animatable: Yes. About CSS Animation Try it »
--- ---
Version: CSS3
--- ---
JavaScript Syntax: object.style.objectPosition="0 10%" Try it »
--- ---

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property Chrome Firefox Safari Opera Edge
object-position 31.0 16.0 7.1 19.0 36.0

Syntax

object-position: position|initial|inherit;

Property Values

Value Description
position Specifies the position of the image or video within the container. The first value is the x-coordinate, and the second value is the y-coordinate. Examples include: object-position: 50% 50%;<br>object-position: right top;<br>object-position: left bottom;<br>object-position: 250px 125px;
initial Sets this property to its default value. About initial
inherit Inherits this property from its parent element. About inherit
❮ Css3 Pr Target Css3 Pr Text Wrap ❯