๐Ÿ’๊ณต๋ถ€/CSS

[CSS] scroll-snap ๊ณผ scroll-behavior

rindev 2020. 11. 8. 17:30

 

 

์Šคํฌ๋กค์„ ์–ด๋–ป๊ฒŒํ•˜๋Š”๊ฒŒ ์ข‹์„๊นŒ ๊ณ ๋ฏผํ•˜๋˜ ์ฐฐ๋‚˜ ์ € ์นœ๊ตฌ๋“ค์„ ์•Œ๊ฒŒ ๋๋‹ค! 

 

๐Ÿ’scroll-snap

๋ถ€๋ชจ์—๊ฒŒ scroll-snap-type : ์ถ• ํƒ€์ž…; ๋ฅผ ์ฃผ๊ณ ,

์ž์‹์—๊ฒŒ scroll-snap-align : ๊ธฐ์ค€์ ; ์„ ์ฃผ๋ฉด ๋œ๋‹ค.

 

์˜ˆ์‹œ)

.container {
	scroll-snap-type: y proximity; /* y์ถ•์œผ๋กœ ์Šคํฌ๋กค, proximity(๊ทผ์ฒ˜์— ์™”์„ ๋•Œ๋งŒ ์Šค๋ƒ…) */
    		/* mandatory ํ•˜๋ฉด ์•„์ฃผ ์กฐ๊ธˆ๋งŒ ์›€์ง์—ฌ๋„ ์ž๋™์Šคํฌ๋กค์ด ๋จ */
}

.item {
	scroll-snap-align: start; /* ์ž์‹์˜ ์‹œ์ž‘๋ถ€๋ถ„์„ ๋งž์ถค */
}

 

 

๐Ÿ’scroll-behavior

scroll-behavior: smooth; ๋ฅผ ์ฃผ๋ฉด ์Šคํฌ๋กค์ด ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์Šฅ์Šฅ ์›€์ง์ด๊ฒŒ ๋œ๋‹ค.

 

 

 

!!์ฐธ๊ณ !!

www.w3.org/TR/2019/CR-css-scroll-snap-1-20190319/

 

www.w3schools.com/cssref/pr_scroll-behavior.asp

 

CSS Scroll Snap Module Level 1

Abstract This module contains features to control panning and scrolling behavior with “snap positions”. CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. Status of this document This

www.w3.org