CSS Background Spacing Properties

we can specify an image in the X-axis (horizontal space) and Y-axis (vertical space), direction.
therefore with the help of the background-spacing property can set the spacing between the two or more images.
let’s see the following CSS code fragment which shows how to use the background-spacing property:

1. CSS code example for Background-spacing


In the above example if you see that the spacing has taken in the pixels which are 20px and 60px, therefore 20px indicate the spacing in X-axis direction and 60px indicate the spacing in Y-direction.

as you see in the above CSS code portion background-repeat value is,repeat-x mean that background images repeated in X-axis direction only.

2. CSS code example for Background-spacing


In this example, background-repeat value repeat-y means that images repeat in Y-axis direction with spacing 2% and 2% (percentage), which space in X-axis direction and Y-axis Direction. the spacing value in percentage respected in X and Y direction.


Here, background-image repeated in Horizontal direction and Vertical direction (X-axis and Y-axis Direction). background images spacing 15px and 15px which maintain spacing in X-axis and Y-axis direction. the image related in certain viewpoint display or div. if you want to repeat background-image in both directions you can use andbackground-repeat: repeat-x;background-repeat: repeat-y; set the background-spacing for gapping both images put the spacing value in pixel or percentage.

The background-origin property was introduced for the purpose of setting the background-position area of an element.

the property allows specifying whether the background will be positioned to the.border box content boxpadding box

Therefore these properties can be used in conjunction with the background-image and background-clip properties

to modify the position of a background image to match the clipping effect.