--- title: object-position slug: Web/CSS/object-position translation_of: Web/CSS/object-position ---
{{CSSRef}}

Die Eigenschaft object-position bestimmt  die Ausrichtung des Elements in seiner Box.

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

/* Globale Werte */
object-position: inherit;
object-position: initial;
object-position: unset;

{{cssinfo}}

Syntax

Values

<position>
Is a {{ cssxref("<position>") }}, that is one to four values representing a 2D position regarding the edges of the element's box. Relative or absolute offsets can be given. Note that the position can be set outside of the element's box.

Formal syntax

{{csssyntax}}

Example

HTML content

<img id="object-position-1" src="https://mdn.mozillademos.org/files/12668/MDN.svg" alt="MDN Logo"/>
<img id="object-position-2" src="https://mdn.mozillademos.org/files/12668/MDN.svg" 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%;
}

Output

{{ EmbedLiveSample('Example', '100%','300px') }}

Specifications

Specification Status Comment
{{SpecName('CSS4 Images', '#the-object-position', 'object-position')}} {{Spec2('CSS4 Images')}} The from-image and flip keywords have been added.
{{SpecName('CSS3 Images', '#the-object-position', 'object-position')}} {{Spec2('CSS3 Images')}} Initial definition

Browser compatibility

{{ CompatibilityTable }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 31.0 {{ CompatGeckoDesktop("36") }} {{CompatNo}} 11.60{{ property_prefix("-o") }}
19.0
10.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.4.4 {{ CompatGeckoDesktop("36") }} {{CompatNo}} 11.5{{ property_prefix("-o") }}
24
{{ CompatNo }}

[1] WebKit Nightly fixed in bug 122811.

See also