CSS scroll-padding-right Property

❮ Previous Reference Next ❯

Example

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





1
2
3

Meaning:

The scroll-padding-right CSS property defines offsets for the right of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user.

This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.

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



Standard Syntax

scroll-padding-right: 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-right: auto;
}
❮ Previous Reference Next ❯