WikiGalaxy

Personalize

CSS Object Position

Introduction:

The CSS object-position property is used to specify the alignment of the content within its container. It is often used in conjunction with the object-fit property.

Default Value:

50% 50%: This centers the content within the container.

Usage:

The object-position property accepts values similar to background-position, such as percentages, length values, or keywords like top, right, bottom, and left.


        .example {
            width: 300px;
            height: 200px;
            object-fit: cover;
            object-position: top right;
        }
        

Practical Example:

In this example, the image is positioned at the top-right corner of the container. This is useful when you want to highlight a specific part of an image.

HTML Code:

Example Image
logo of wikigalaxy

Newsletter

Subscribe to our newsletter for weekly updates and promotions.

Privacy Policy

 • 

Terms of Service

Copyright © WikiGalaxy 2025