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>
  • 相关阅读:
    Linux下一个patch补丁命令
    资本中国人物-金融
    深入浅出JMS(一)——JMS简要
    在JBuilder8在使用ANT
    mysql存储引擎
    Linux系统监控
    SIEM
    mysql主从数据库复制
    JVM中可生成的最大Thread数量
    磁盘IO性能监控(Linux 和 Windows)
  • 原文地址:https://www.cnblogs.com/anjingdian/p/15569858.html
Copyright © 2011-2022 走看看