jQueryouterWidth ()メソッド

❮jQueryHTML/ CSSメソッド

<div>要素の外側の幅を返します。

$("button").click(function(){
  alert($("div").outerWidth());
});

定義と使用法

externalWidth()メソッドは、最初に一致した要素の外側の幅を返します。

下の画像が示すように、この方法にはパディングとボーダーが含まれます。

ヒント:マージンを含めるには、outerWidth(true)を使用します。

jQueryディメンション


関連する方法:


構文

$(selector).outerWidth(includeMargin)

Parameter Description
includeMargin Optional. A Boolean value specifying whether or not to include the margin
  • false - Default. Does not include the margin
  • true - Includes the margin

自分で試してみてください-例


を含めるかどうかを指定します。


するwidth()、height()、innerHeight()、innerWidth()、outerWidth()、outerHeight()の使用方法。


❮jQueryHTML/ CSSメソッド