ドキュメント

CSS/outerHeight

From jQuery JavaScript Library

Jump to: navigation, search

« Back to CSS

outerHeight[margin] )

Gets the outer height (includes the border and padding by default) for the first matched element.
This method works for both visible and hidden elements. It is not supported for elements that are indirectly hidden by consequence of a parent being hidden. Please use .height() for the window and document.
Arguments:
margin (Optional)Boolean
When set to true the margin of the element will be included in the calculations.
Examples:

Get outerHeight

var p = $("p:first");
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    var p = $("p:first");
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );

  });
  </script>
  <style>
  p { margin:10px;padding:5px;border:2px solid #666; }
  </style>
</head>
<body>
  <p>Hello</p><p></p>
</body>
</html>

NameType