yesslkim_blog
aboutposts
JAVASCRIPT
1 posts
offsetWidth vs clientWidth vs getBoundingClientRect()

해당 게시글은 width를 기준으로 작성되었습니다 👩‍🎨 1. offsetWidth vs clientWidth의 차이 는 border까지 포함한 길이를 뜻한다. offsetWidth 설명사진 는 컨텐츠 크기를 기준으로 한다. (padding 포함) 그림에서도 볼 수 있지만 스크롤바는 포함되지 않는다. clientWidth 설명사진 2. (offsetWidth vs clientWidth) vs getBoundingClientRect()의 차이 💡 2.1 getBoundingClientRect()은 많은 일을 해! 우선 getBoundingClientRect() 메서드는 객체를 리턴한다. 이는 엘리먼트의 사이즈와 뷰포트를 기준으로 한 엘리먼트의 위치를 반환한다. getBoundingClientRect()으로 리턴 받을 수 있는 값 : /, /, , , , getBoundingClientRect()메서드 설명 여기서 와 는 offsetWidth와 일치한다. 즉 padding, borde…

February 26, 2022
JAVASCRIPT

© 2022 예슬 powered by zoomkoding-gatsby-blog