The background-position CSS property sets the initial position for each background image. The position is relative to the position layer set by background-origin. The source for this interactive example is stored in a GitHub repository. The second and fourth values are offsets for the preceding X and Y keyword values:. You will need to offset using absolute values. It is often used to define a size as relative to an element's parent object.
The linear-gradient CSS function creates an image consisting of a progressive transition between two or more colors along a straight line. Additional CSS image functions include image , image-set , and cross-fade. Images can be used with numerous CSS properties, such as background-image, border-image, content, cursor, and list-style-image. As with any gradient, a linear gradient has no intrinsic dimensions ; i. Its concrete size will match the size of the element it applies to. For this reason, linear-gradient won't work on background-color and other properties that use the CSS data type represents a color in the sRGB color space. A linear gradient is defined by an axis—the gradient line —and two or more color-stop points.
The background-position property in CSS allows you to move a background image or gradient around within its container. Length values are pretty simple: the first value is the horizontal position, second value is the vertical position. So px 5px will move the image px to the right and five pixels down. You can set length values in px , em , or any of the other CSS length values.
The background-position property gives the initial position of a specified background image. This property may only be applied to block-level elements and replaced elements. Percentages and lengths may also be used to assign the position of the background image. Percentages are relative to the size of the element. Although lengths are allowed, they are not recommended due to their inherent weakness in dealing with differing display resolutions.