Object-position Property

Last updated: 2026-09-13

object-position Object-position Property

The object-position property controls where the content of a replaced element such as an <img> or <video> is shown inside its container. When object-fit leaves space or crops the content, object-position adjusts the alignment focus so key parts stay inside the visible area.

Category
Initial Value50% 50%
InheritedNo
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

object-position: <position>;

⚙️ Values

ValueTypeDescription
<length> | <percentage>TypeThe coordinates of the content position
left | center | right | top | bottomKeywordA predefined position

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
object-position v30 v12 v36 v9 v16
Supported in all major browsers
Tip: object-position is usually paired with object-fit: cover to keep the key content (like a person's head) within the crop.
Tip: It supports keywords (left, center, right, top, bottom) and concrete length or percentage values, similar to background-position.

❓ FAQ

QCan the object-position property be animated with CSS transitions?
AYes. object-position is a length/percentage property, so it supports transition and animation — commonly used for a focus pan on hover, such as the image slowly moving from the center to the top-left when the mouse enters. Note that animating it triggers repaint, so watch performance with large images; you can combine it with composited properties like transform.
QWhat are the object-position percentage values relative to in CSS?
APercentages are computed against the difference between the container size and the content size. 50% 50% is the default center alignment; 100% 100% aligns the content's bottom-right corner with the container's bottom-right; 0% 50% aligns the content's left edge with the container's left edge. Simply put, the larger the percentage, the further the content moves in that direction, and the excess is cropped or left as space.
QHow do object-fit: cover and object-position work together in CSS?
Acover fills the container and crops the excess, and object-position decides where the crop happens. For an avatar that must keep the top of the head, write object-fit: cover; object-position: top;. In image walls and e-commerce main images, aligning every image's visual focus (face, product subject) to a fixed position looks far more professional.
QAre object-position: center and object-position: 50% 50% the same?
AThe effect is identical: both center the content horizontally and vertically. The position syntax matches background-position, supporting the left, center, right, top, and bottom keywords, length values, and percentages, plus offset forms like right 10px top 20px. Use lengths or percentages when you need precise control.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏