CSS scroll-margin-inline-end
The scroll-margin-inline-end
property specifies the block-end that will be used as an offset for the scroll snap area. This property applies to block-level elements such as <div>
, <p>
, and <section>
.
When using scroll-margin-inline-end
, the browser will reserve space at the block-end of the scroll container. This means that when an anchor is linked, the target element will be offset from the block-end of the scroll container by the specified amount.
Let's see an example to better understand how scroll-margin-inline-end
works:
In the example above, we have a <div>
element with a scroll-margin-inline-end
of 20px. This will create a scroll snap area at the block-end of the <div>
element, offsetting the content by 20px.
You can adjust the value of scroll-margin-inline-end
to control the offset amount for the scroll snap area.