CSS Background Position

CSS background-position is a property used to control the positioning of a background image within the background area of an HTML element.

It allows you to specify the horizontal and vertical placement of the image.

background-position: horizontal vertical;

You can specify the positioning using keywords (left, right, top, bottom) or specific coordinates (%) . Here are some common values:



Aligned to Bottom-Right Corner:

Example
Try yourself
        
            body {
    background-image: url('/images/common/background.jpeg');
    background-position: right bottom;
    background-repeat: no-repeat;
}

        
    

Aligned to Top-Left Corner::

Example
Try yourself
        
            body {
    background-image: url('/images/common/background.jpeg');
    background-position: right bottom;
    background-repeat: no-repeat;
}

        
    

Custom Positioning:

Example
Try yourself
        
            body {
    background-image: url('/images/common/background.jpeg');
    background-position: 50% 25%;
    background-repeat: no-repeat;
}

        
    

This example positions the background image at 50% from the left and 25% from the top of the background area.