CSS scroll-padding-block Property

❮ Previous Reference Next ❯

Example

.scroller {
  text-align: left;
  width: 250px;
  height: 250px;
  overflow-x: scroll;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid #000;
  scroll-snap-type: y mandatory;
  scroll-padding-block: 2rem;
}





1
2
3

Meaning:

The scroll-padding-block CSS property sets the scroll padding of an element in the block dimension.

The scroll-padding-block property is a shorthand for the following CSS properties:

Default value:auto
Inherited:No
Animatable:No
Version:CSS3
JavaScript syntax:
object.style.scrollPaddingBlock="auto|[length|percentage]|initial|inherit|revert|revert-layer|unset";



Standard Syntax

scroll-padding-block: auto|[length|percentage]|initial|inherit|revert|revert-layer|unset;



Browser Support




Status







Property Values

The following table describes the values of this property:

Value Description
auto The offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
[length|percentage] An inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.
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 {
  scroll-padding-block: auto;
}
❮ Previous Reference Next ❯