zoukankan      html  css  js  c++  java
  • offset、scroll、client区别

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2  <html xmlns="http://www.w3.org/1999/xhtml">
     3  <head>
     4      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     5      <title>111</title>
     6      <style type="text/css">
     7      body{
     8          margin: 0;
     9          padding: 0;
    10      }
    11      </style>
    12  </head>
    13  <body>
    14      <div id="out1" style="100px;height:100px;overflow:scroll; margin:50px;">
    15          <div style="background:#666666;200px;height:200px;"></div>
    16      </div>
    17      <script type="text/javascript" src="test51.js"></script>
    18  </body>
    19  </html>
    1 var divs = document.getElementById("out1");
    2 console.log("offsetHeight:" + divs.offsetHeight);
    3 console.log("scrollHeight:" + divs.scrollHeight);
    4 console.log("clientHeight:" + divs.clientHeight);//滚动条占据17个像素
    5 console.log("offsetWidth:" + divs.offsetWidth);
    6 console.log("scrollWidth:" + divs.scrollWidth);
    7 console.log("clientWidth:" + divs.clientWidth);//滚动条占据17个像素
  • 相关阅读:
    setTimeout详解
    【康娜的线段树】
    【[CQOI2016]手机号码】
    【[IOI2014]Wall 砖墙】
    【[1007]梦美与线段树】
    【[POI2010]ANT-Antisymmetry】
    【[HEOI2016/TJOI2016]排序】
    【[SCOI2016]背单词】
    【[HNOI2008]GT考试】
    【[JSOI2007]建筑抢修】
  • 原文地址:https://www.cnblogs.com/qzsonline/p/2506210.html
Copyright © 2011-2022 走看看