CSS background-position-y Property

❮ Previous Reference Next ❯

Example

div {
  width: 300px;
  height: 300px;
  background-color: red;
  background-image: url("fox.png");
  background-repeat: no-repeat;
  background-position-y: center;
}






Meaning:

The background-position-y CSS property specifies the initial vertical position for each background image.

The position is relative to the position layer set by background-origin.

Default value:0%
Inherited:No
Animatable:Discrete
Version:CSS3
JavaScript syntax:
object.style.backgroundPositionY="top|center|bottom|length|percentage|initial|inherit|revert|revert-layer|unset";



Standard Syntax

background-position-y: top|center|bottom|length|percentage|initial|inherit|revert|revert-layer|unset;



Browser Support




Status







Property Values

The following table describes the values of this property.

Value Description
top Aligns the top edge of the background image with the top edge of the background position layer.
center Aligns the vertical center of the background image with the vertical center of the background position layer.
bottom Aligns the bottom edge of the background image with the bottom edge of the background position layer.
length The offset of the given background image's horizontal edge from the corresponding background position layer's top horizontal edge. (Some browsers allow assigning the bottom edge for offset).
percentage The offset of the given background image's vertical position relative to the container. A value of 0% means that the top edge of the background image is aligned with the top edge of the container, and a value of 100% means that the bottom edge of the background image is aligned with the bottom edge of the container, thus a value of 50% vertically centers the background image.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  background-position-y: 0%;
}
❮ Previous Reference Next ❯