Interview Question

What is object-position?

object-position aligns replaced content within its element box.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The object-position property positions replaced content inside its box. β€’ It works with object-fit when the content and box have different proportions. β€’ Percentages and keywords choose the alignment point. β€’ It does not move the element’s own box.

💡 Simple Example

img { object-fit: cover; object-position: 50% 25%; }

⚡ Quick Revision

object-position aligns replaced content within its element box.