CSS p { margin:10px;padding:5px;border:2px solid #666; }
HTML <p>Hello</p><p></p>
innerHeight Get the current computed height for the first element in the set of matched elements, including padding but not border. innerHeight():Integer
Added in version 1.2.6
This method returns the height of the element, including top and bottom padding, in pixels. This method is not applicable to window and document objects; for these, use .height() instead.
Example 1:
Get the innerHeight of a paragraph.
Javascript var p = $("p:first"); $("p:last").text( "innerHeight:" + p.innerHeight() );
CSS p { margin:10px;padding:5px;border:2px solid #666; }
HTML <p>Hello</p><p></p>
width Get the current computed width for the first element in the set of matched elements. width():Integer
Added in version 1.0
The difference between .css(width) and .width() is that the latter returns a unit-less pixel value (for example, 400) while the former returns a value with units intact (for example, 400px). The .width() method is recommended when an element's width needs to be used in a mathematical calculation.
This method is also able to find the width of the window and document. $(window).width(); // returns width of browser viewport $(document).width(); // returns width of HTML document
Note that .width() will always return the content width, regardless of the value of the CSS box-sizing property.