vadnica-logo
X

CSS Property: scroll-margin-block

The scroll-margin-block property defines the margin between the snap position and the container in the block direction. This means that when scrolling stops, the scroll will quickly adjust and stop at a specified distance in the block direction between the snap position and the container. The scroll-margin-block property is a shorthand for scroll-margin-block-start and scroll-margin-block-end properties. The values for the scroll-margin-block property can be set in different ways.

If the property has two values: scroll-margin-block: 120px 200px;

  1. The start margin is 120px.
  2. The end margin is 200px.

If the property has one value: scroll-margin-block: 120px;

  1. Both start and end margins are 120px.

To see the effect of the scroll-margin-block property, both scroll-margin-block and scroll-snap-align properties must be set on child elements, while the scroll-snap-type property must be set on the parent element.

EXAMPLE
RESULT

Thank you for visiting! Adding privacy policy.

© 2024 All rights reserved.

Vam je koda pomagala? Če želite podpreti moj trud pri pripravi vodičev in vzdrževanju strani, mi lahko namenite donacijo za kavo.