Created
March 12, 2014 20:15
-
-
Save anonymous/9515376 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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