zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    java 支付宝即时到帐提交订单dome
    C#字符串string的常用使用方法(转载)
    UltraEdit 回车符替换空格
    java 七牛上传图片到服务器(采用的html5 压缩 传输base64方式)
    c# 多播委托
    c# 泛型委托
    c# 求数组的最大值
    c# 匿名函数和lamda表达式语法
    匿名函数和lamda表达式
    导出Excel之Epplus使用教程4(其他设置)
  • 原文地址:https://www.cnblogs.com/anjingdian/p/15569858.html
Copyright © 2011-2022 走看看