scroll-snap-stop
Quick Summary for scroll-snap-stop
The scroll-snap-stop CSS property defines whether the scroll container is allowed to "pass over" possible snap positions.
Code Usage for scroll-snap-stop

<pre class="brush: css notranslate"><code><span class="token comment">/ Keyword values /</span> <span class="token property">scroll-snap-stop</span><span class="token punctuation">:</span> normal<span class="token punctuation">;</span> <span class="token property">scroll-snap-stop</span><span class="token punctuation">:</span> always<span class="token punctuation">;</span> <span class="token comment">/ Global values /</span> <span class="token property">scroll-snap-type</span><span class="token punctuation">:</span> inherit<span class="token punctuation">;</span> <span class="token property">scroll-snap-type</span><span class="token punctuation">:</span> initial<span class="token punctuation">;</span> <span class="token property">scroll-snap-type</span><span class="token punctuation">:</span> unset<span class="token punctuation">;</span> </code></pre>

More Details for scroll-snap-stop

scroll-snap-stop

The scroll-snap-stop CSS property defines whether the scroll container is allowed to "pass over" possible snap positions.

/* Keyword values */ scroll-snap-stop: normal; scroll-snap-stop: always;  /* Global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; 

Syntax

Values

normal

When the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions.

always

The scroll container must not "pass over" a possible snap position; and must snap to the first of this elements' snap positions.

Formal definition

Initial valuenormal
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

normal | always

Examples

Snapping in different axes

This example is duplicated from scroll-snap-type with minor variances.

CSS
/* setup */ :root, body {   height: 100%;   display: flex;   align-items: center;   justify-content: space-between;   flex-flow: column nowrap;   font-family: monospace; } .container {   display: flex;   overflow: auto;   outline: 1px dashed lightgray;   flex: none; }  .container.x {   width: 100%;   height: 128px;   flex-flow: row nowrap; }  .container.y {   width: 256px;   height: 256px;   flex-flow: column nowrap; } /* definite scroll snap */ .mandatory-scroll-snapping > div {   scroll-snap-stop: always; } .proximity-scroll-snapping > div {   scroll-snap-stop: normal; } /* scroll-snap */ .x.mandatory-scroll-snapping {   scroll-snap-type: x mandatory; }  .y.mandatory-scroll-snapping {   scroll-snap-type: y mandatory; }  .x.proximity-scroll-snapping {   scroll-snap-type: x proximity; }  .y.proximity-scroll-snapping {   scroll-snap-type: y proximity; }  .container > div {   text-align: center;   scroll-snap-align: center;   flex: none; }  .x.container > div {   line-height: 128px;   font-size: 64px;   width: 100%;   height: 128px; }  .y.container > div {   line-height: 256px;   font-size: 128px;   width: 256px;   height: 256px; } /* appearance fixes */ .y.container > div:first-child {   line-height: 1.3;   font-size: 64px; } /* coloration */ .container > div:nth-child(even) {   background-color: #87EA87; }  .container > div:nth-child(odd) {   background-color: #87CCEA; } 
HTML
<div class="container x mandatory-scroll-snapping" dir="ltr">   <div>X Mand. LTR </div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container x proximity-scroll-snapping" dir="ltr">   <div>X Proximity LTR</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container y mandatory-scroll-snapping" dir="ltr">   <div>Y Mand. LTR</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container y proximity-scroll-snapping" dir="ltr">   <div>Y Prox. LTR</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container x mandatory-scroll-snapping" dir="rtl">   <div>X Mandatory RTL</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container x proximity-scroll-snapping" dir="rtl">   <div>X Proximity RTL</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container y mandatory-scroll-snapping" dir="rtl">   <div>Y Mand. RTL</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div>  <div class="container y proximity-scroll-snapping" dir="rtl">   <div>Y Prox. RTL</div>   <div>2</div>   <div>3</div>   <div>4</div>   <div>5</div> </div> 
Result

Specifications

Specification
CSS Scroll Snap Module Level 1 # scroll-snap-stop

See also

CSS Scroll Snap Well-Controlled Scrolling with CSS Scroll Snap

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
“We ought to take outdoor walks in order that the mind may be strengthened and refreshed by the open air and much breathing.".
Seneca
Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.