码迷,mamicode.com
首页 > Web开发 > 详细

jQuery—一些常见方法(3)【width(),innerWidth(),outerWidth()】

时间:2016-08-18 19:51:10      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../jq-practice/jq/jquery-2.2.1.min.js"></script>
    <script>
        $(function(){
            alert($(div).width());          //width
            alert($(div).innerWidth());      //width+padding
            alert($(div).outerWidth());      //width+padding+border
            alert($(div).outerWidth(true));     //width+padding+border+margin
            
        });
    </script>
</head>
<body>
<div style="width: 100px; height: 100px; padding: 10px; border: 4px solid red; margin: 5px; background: blue;" ></div>

</body>
</html>

 

jQuery—一些常见方法(3)【width(),innerWidth(),outerWidth()】

标签:

原文地址:http://www.cnblogs.com/moranhuishou/p/5784673.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!