- Return Value:
- Returns the corresponding element’s layout pixel width.
The following program will illustrate the solution using offsetWidth:
The following program will illustrate the solution using clientWidth:
Note: clientWidth returns the inner width which includes padding but excludes borders and scroll bars whereas offsetWidth returns the outer width which includes padding and borders.
- p5.js | width variable
- CSS | min-width Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.