Dimensions

jQuery provides methods to work with dimensions of selected elements.

You can assign new value to selected elements by number of function, that has two arguments:

  • index - index of element
  • value - new value to be assigned

There are three types of dimensions:

  • size of content - defines size of element's content, i.e. size without padding, margin and border
  • inner size - size of element including padding
  • outer size - size of element including including padding, border, and optionally margin

Unlike css properties, all dimension values are in pixels only.

method description
width() Returns the width of the first element's content.
width(value | func) Sets the width of the content of the selected elements.
innerWidth() Returns the inner width of the first element.
innerWidth(value | func) Sets the inner width of the selected elements.
outerWidth([includeMargin]) Returns the outer width of the first element.
outerWidth(value [,includeMargin]) Sets the outer width of the selected elements.
outerWidth(func) Sets the outer width of the selected elements.
height() Returns the height of the first element's content.
height(value | func) Sets the height of the content of the selected elements.
innerHeight() Returns the inner height of the first element.
innerHeight(value | func) Sets the inner height of the selected elements.
outerHeight([includeMargin]) Returns the outer height of the first element.
outerHeight(value [,includeMargin]) Sets the outer height of the selected elements.
outerHeight(func) Sets the outer height of the selected elements.