CSS background position property

CSS background position is used to set the background image position inside the block.

Syntax

Output

This is the HTML paragraph inside the div for background position text. This div contains a background image of the globe. This background image has given position center. The background center makes it at the center position in the block.


CSS background position values list

Sr. No.valueDescription
1leftUsed to make background image to the left position of the block.
2rightUsed to make background image to the right position of the block.
3topUsed to make background image to the top position of the block.
4bottomUsed to make background image to the bottom position of the block.
5centerUsed to make background image to the center position of the block.
6position in pxUsed to give background image position value in px e.g. 20px, 50px etc.
7position in percentageUsed to give background image position value in percentage (20%, 50% etc.)
8initialUsed to define as the property initial value.
9inheritUsed to define the computed value of the property on the elements parent.

Reference

The CSS background specification defines in this official webpage

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.