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(true) method 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(); });Teste e veja‹/›
Get the external height of the DIV element (including margins):
$("div").click(function(){ $(this).outerHeight(true); });Teste e veja‹/›
Set the external height of all paragraphs:
$("button").click(function(){ $("p").outerHeight()100); });Teste e veja‹/›
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); });Teste e veja‹/›
Exibir a diferença entre width(), height(), innerHeight(), innerWidth(), outerWidth() e outerHeight():
$("button").click(function(){ $("div").width(); $("div").innerWidth(); $("div").outerWidth(); $("div").height(); $("div").innerHeight(); $("div").outerHeight(); });Teste e veja‹/›
Parâmetro | Descrição |
---|---|
value | Número inteiro representando pixels, ou número inteiro com unidade opcional adicional (como string) |