offsetWidth是个只读属性,原生offsetWidth = border + padding + 垂直滚动条宽度+ width
The HTMLElement.offsetWidth
read-only property returns the layout width of an element. Typically, an element's offsetWidth
is a measurement which includes the element borders, the element horizontal padding, the element vertical scrollbar (if present, if rendered) and the element CSS width.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.offsetWidth