the difference between Scrollwidth,clientwidth and offsetwidth _ Experience Exchange
ScrollWidth
Is the width of the actual content of the object, not the width of the edge, which changes depending on how much content is in the object (the actual width of the object may be changed by more content).
ClientWidth
Is the width of the object visible, without edges such as the scroll bar, which changes with the window's display size.
Offsetwidth
is the visible width of the object, and edges such as the package scroll bar change as the window's display size changes.
An example of ScrollWidth and clientwidth:
Enter content in the text box, and the value of ScrollWidth and ClientWidth is the same when the horizontal scroll bar does not come out. When a line exceeds the width of the text box, there is a horizontal scroll bar, and the value of the scrollwidth is changed.
ScrollWidth is the width of the actual content of the object.
ClientWidth is the width (without edges) The object sees, and this example does not change.
An example of ClientWidth and offsetwidth:
The value of offsetwidth is always greater than the value of clientwidth.
ClientWidth is the width that the object sees (without edges)
Offsetwidth is the width that the object sees (including edges, such as the width of the scroll bar)
The above is the difference between Scrollwidth,clientwidth and offsetwidth _ Experience Exchange content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!