MDN will be in maintenance mode on Wednesday September 20th, starting at 10 AM Pacific / 5 PM UTC, for about 1 hour.

The object-position CSS property determines the alignment of the selected element inside its box.

/* <position> values */
object-position: 100px 50px;

/* Global values */
object-position: inherit;
object-position: initial;
object-position: unset;

Initial value50% 50%
Applies toreplaced elements
Percentagesrefer to width and height of element itself
Computed valueas specified
Animation typerepeatable list of simple list of length, percentage, or calc
Canonical orderthe unique non-ambiguous order defined by the formal grammar



From one to four values that define the 2D position of the element. Relative or absolute offsets can be used. Note that the position can be set outside of the element's box.

Formal syntax


<position> = [[ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]]

<length-percentage> = <length> | <percentage>


HTML content

<img id="object-position-1" src="" alt="MDN Logo"/>
<img id="object-position-2" src="" alt="MDN Logo"/>

CSS content

img {
   width: 300px;
   height: 250px;
   border: 1px solid black;
   background-color: silver;
   margin-right: 1em;
   object-fit: none;

#object-position-1 {
  object-position: 10px;

#object-position-2 {
  object-position: 100% 10%;



Specification Status Comment
CSS Image Values and Replaced Content Module Level 4
The definition of 'object-position' in that specification.
Working Draft The from-image and flip keywords have been added.
CSS Image Values and Replaced Content Module Level 3
The definition of 'object-position' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 31.0 16 36 (36) No support 11.60-o
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.4.4 36 (36) No support 11.5-o
No support

[1] WebKit Nightly fixed in bug 122811.

See also

Document Tags and Contributors

 Last updated by: mfluehr,