English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery outerHeight() 메서드

jQuery HTML/CSS 메서드

outsideHeight() 메서드는 선택된 요소의 외부 높이(padding, border 포함)를 가져오거나 설정합니다。

outsideHeight(true) 메서드는 선택된 요소의 외부 높이(padding, border 및 마진 포함)를 가져오거나 설정합니다。

externalHeight() 메서드를 사용할 때가져옵니다높이를 설정할 때, 그것은첫 번째 선택된 요소의 높이。

externalHeight() 메서드를 사용할 때설정높이를 설정할 때, 그것은모든 선택된 요소의 높이。

如下图所示,externalHeight() 메서드는 padding과 border를 포함합니다:

마진을 포함하려면 outerHeight(true)를 사용하세요。

문법:

외부 높이를 가져옵니다:

$(selector).outerHeight()

마진을 포함한 외부 높이를 가져옵니다:

$(selector).outerHeight(true)

외부 높이를 설정합니다:

$(selector).outerHeight(value)

예제

DIV 요소의 외부 높이를 가져옵니다:

$("div").click(function(){
  $(this).outerHeight();
});
테스트를 보세요‹/›

DIV 요소의 외부 높이(마진 포함)를 가져옵니다:

$("div").click(function(){
  $(this).outerHeight(true);
});
테스트를 보세요‹/›

모든 단락의 외부 높이를 설정합니다:

$("button").click(function(){
  $("p").outerHeight("}}100);
});
테스트를 보세요‹/›

모든 단락의 외부 높이를 다른 단위로 설정합니다:

$("#btn1").click(function(){
  $("p").outerHeight("}}100);
});
$("#btn2").click(function(){
  $("p").outerHeight("7em");
});
$("#btn3").click(function(){
  $("p").outerHeight("100vh");
});
테스트를 보세요‹/›

width(), height(), innerHeight(), innerWidth(), outerWidth(), outerHeight() 간의 차이를 보여주기:

$("button").click(function(){
  $("div").width();
  $("div").innerWidth();
  $("div").outerWidth();
  $("div").height();
  $("div").innerHeight();
  $("div").outerHeight();
});
테스트를 보세요‹/›

파라미터 값

파라미터설명
value픽셀 수를 나타내는 정수 또는 선택가능한 단위를 추가한 정수(문자로)

jQuery HTML/CSS 메서드