• jQuery尺寸 安静点


    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <title>14_元素的尺寸</title>
    </head>
    <style>
      div {
        width: 100px;
        height: 150px;
        background: red;
        padding: 10px;
        border: 10px #fbd850 solid;
        margin: 10px;
      }
    </style>
    </head>
    
    <body>
    <div>div</div>
    
    <!--
    1. 内容尺寸
      height(): height
      width(): width
    2. 内部尺寸
      innerHeight(): height+padding
      innerWidth(): width+padding
    3. 外部尺寸
      outerHeight(false/true): height+padding+border  如果是true, 加上margin
      outerWidth(false/true): width+padding+border 如果是true, 加上margin
    -->
    <script src="js/jquery-1.10.1.js" type="text/javascript"></script>
    <script>
      var $div = $('div')
      // 1. 内容尺寸
      console.log($div.width(), $div.height())  // 100 150
      // 2. 内部尺寸
      console.log($div.innerWidth(), $div.innerHeight()) //120 170
      // 3. 外部尺寸
      console.log($div.outerWidth(), $div.outerHeight()) //140 190
      console.log($div.outerWidth(true), $div.outerHeight(true)) //160 210
    
    </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <title>14_元素的尺寸</title>
    </head>
    <style>
      div {
        width: 100px;
        height: 150px;
        background: red;
        padding: 10px;
        border: 10px #fbd850 solid;
        margin: 10px;
      }
    </style>
    </head>

    <body>
    <div>div</div>

    <!--
    1. 内容尺寸
      height(): height
      width(): width
    2. 内部尺寸
      innerHeight(): height+padding
      innerWidth(): width+padding
    3. 外部尺寸
      outerHeight(false/true): height+padding+border  如果是true, 加上margin
      outerWidth(false/true): width+padding+border 如果是true, 加上margin
    -->
    <script src="js/jquery-1.10.1.js" type="text/javascript"></script>
    <script>
      var $div = $('div')
      // 1. 内容尺寸
      console.log($div.width(), $div.height())  // 100 150
      // 2. 内部尺寸
      console.log($div.innerWidth(), $div.innerHeight()) //120 170
      // 3. 外部尺寸
      console.log($div.outerWidth(), $div.outerHeight()) //140 190
      console.log($div.outerWidth(true), $div.outerHeight(true)) //160 210

    </script>
    </body>

    </html>
  • 相关阅读:
    序列、元组、列表(基本的增、删、改、查)
    Python基础运算符(算数、比较、赋值、逻辑、成员)
    2015年9月14日记事
    2014年3月31日梦
    华为S5700系列交换机配置文件导出、导入
    C语言单链表简单实现(简单程序复杂化)
    北邮《大学英语2》第三次阶段作业带答案
    C++走向远洋——30(六周,项目一1.0)
    C++走向远洋——29(长方柱类)
    C++走向远洋——28(项目三,时间类,2)
  • 原文地址:https://www.cnblogs.com/anjingdian/p/15569858.html
Copyright © 2020-2023  润新知