English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The outsideHeight() method gets or sets the external height of the selected element (including padding, border).
outsideHeight(truemethod to get or set the external height of the selected element (including padding, border and margin).
When using the externalHeight() methodGetWhen setting the height, it will returnThe first selected elementheight.
When using the externalHeight() methodSetWhen setting the height, it will setAll selected elementsheight.
As shown in the figure below, the externalHeight() method includes padding and border:
To include margin, use outerHeight(true).
Get the external height:
$(selector).outerHeight()
Get the external height including margins:
$(selector).outerHeight(true)
Set the external height:
$(selector).outerHeight(value)
Get the external height of the DIV element:
$("div").click(function(){ $(this).outerHeight(); });Prueba y observa‹/›
Get the external height of the DIV element (including margins):
$("div").click(function(){ $(this).outerHeight(true); });Prueba y observa‹/›
Set the external height of all paragraphs:
$("button").click(function(){ $("p").outerHeight("}}100); });Prueba y observa‹/›
Configure the external height of all paragraphs using different unit settings:
$("#btn1").click(function(){ $("p").outerHeight("}}100); }); $("#btn2").click(function(){ $("p").outerHeight("7em); }); $("#btn3").click(function(){ $("p").outerHeight("100vh); });Prueba y observa‹/›
Mostrar la diferencia entre width(), height(), innerHeight(), innerWidth(), outerWidth() y outerHeight():
$("button").click(function(){ $("div").width(); $("div").innerWidth(); $("div").outerWidth(); $("div").height(); $("div").innerHeight(); $("div").outerHeight(); });Prueba y observa‹/›
Parámetro | Descripción |
---|---|
value | Entero que representa un número de píxeles, o un entero con una unidad de medida opcional adjunta (como cadena) |