What is the difference between width(), innerWidth() and outerWidth() in jQuery?

MethodIncludes
width()Content only
innerWidth()Content and padding
outerWidth()Content, padding and border
outerWidth(true)Content, padding, border and margin

For a box with width 200, padding 10, border 5 and margin 20 on each side, they give 200, 220, 230 and 270. They need a real browser layout, so they return 0 in a test tool. See Dimensions and Position.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.