Last updated 1 year ago
browser โฉ DOM โฉ type โฉ Element โฉ boxes โฉ Element+boxes โฉ .scrollBox
( .scrollWidth, .scrollHeight ) = .paddingBox + overflow
๐พ Element+boxes
.paddingBox๏ผ.clientWidth/.clientHeight = content + padding
.scrollBox ๏ผ.scrollWidth/.scrollHeight = content + padding + overflow
if no overflow, they are the same.
( .scrollWidth, .scrollHeight ) will round to integer.
use elem.getBoundingClientRect(), if fractional value is needed.
box models
element .paddingBox
document document size
viewport size.
CSS overflow
JS.info โฉ Element size and scrolling โฉ scrollWidth/scrollHeight
Element โฉ
.clientWidth, .clientHeight
.scrollLeft, .scrollTop, .scrollTo(), .scrollWidth, .scrollHeight
Window โฉ
.scrollX, .scrollY