Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2014 20:15
Show Gist options
  • Save anonymous/9515376 to your computer and use it in GitHub Desktop.
Save anonymous/9515376 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Mar 12, 2014.
    7 changes: 7 additions & 0 deletions jsbin.polacoha.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #box {
    width: 200px;
    height: 200px;
    padding: 10px;
    margin: 5px;
    border: 1px solid black;
    }
    15 changes: 15 additions & 0 deletions jsbin.polacoha.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8 />
    <title>Welcome to JS Bin</title>
    <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    </head>

    <body>

    <div id="box">
    </div>

    </body>
    </html>
    16 changes: 16 additions & 0 deletions jsbin.polacoha.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    var $box = $("#box");

    console.clear();

    console.log($box.width()); // 200
    console.log($box.innerWidth()); // 220
    console.log($box.outerWidth()); // 222
    console.log($box.outerWidth(true)); // 232

    console.log("");

    var box = document.getElementById("box");

    console.log(box.clientWidth); // 220
    console.log(box.offsetWidth); // 222
    console.log(box.getBoundingClientRect().width); // 222