首页javascriptwidthjQuery Style - 如何得到外部宽度和高度带边距

jQuery Style - 如何得到外部宽度和高度带边距

我们想知道如何得到外部宽度和高度带边距。

<html>
  <head>
    <script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type='text/javascript'>
$(document).ready(
  function() {
    console.log(
      'outerWidth: '  + $('div').outerWidth({margin: true}) + "\n" + 
      'outerHeight: ' + $('div').outerHeight({margin: true})
    );
  }
);
    </script>
    <style type='text/css'>

div {
    width: 200px;
    height: 200px;
    padding: 10px;
    border: 1px solid rgb(200, 200, 200);
    background: lightblue;
    margin: 10px;
}
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>