zoukankan      html  css  js  c++  java
  • HTML标签的offset、client、 scroll和currentStyle属性

    offsetHeight = borderTopWidth + clientHeight + scrollbarWidth + borderBottomWidth;

    offsetWidth = borderLeftWidth + clientWidth + scrollbarWidth + borderRightWidth;

    元素内部实际可用区域(高) = clientHeight - paddingTopWidth - paddingBottomWidth;

    元素内部实际可用区域(宽) = clientWidth - paddingLeftWidth - paddingRightWidth;

    scrollHeight:文章的实际高度,不管是否已经用纵向滚动条浏览过。

    scrollWidth:文章的实际宽度,不管是否已经用横向滚动条浏览过。

    scrollTop:用纵向滚动条滚过的高度。

    scrollLeft:用横向滚动条滚过的宽度。

    文章未滚过部分(高) = scrollHeight - scrollTop - clientHeight;

    文章未滚过部分(宽) = scrollWidth - scrollLeft - clientWidth;

    offsetTop:如果position是absolute,则是相对于body(纵向滚动条滚到最上面,横向滚动条滚到最左面)左上角那个点y轴之间的差。如果是relative,则是相对于上方或外层元素y轴上的差值。如果是static(position的默认值),则该属性没有意义。

    offsetLeft:如果position是absolute,则是相对于body(纵向滚动条滚到最上面,横向滚动条滚到最左面)左上角那个点x轴之间的差。如果是relative,则是相对于上方或外层元素x轴上的差值。如果是static(position的默认值),则该属性没有意义。

    clientTop:等同于borderTopWidth。

    clientLeft:等同于borderLeftWidth。

    currentStyle:

        height:等同于clientHeight。

        width:等同于clientWidth。

        left:等同于offsetLeft。

        top:等同于offsetTop。

        padding:共有4个,可以单独指定,也可以一起指定。该值是指元素border距元素内可用区域之间的距离。

        margin:共有4个,可以单独指定,也可以一起指定。该值是指距相邻/周围元素之间的距离。当元素position为relative时,其4个值分别等同于top、right、bottom和left

    js_get_width_height

  • 相关阅读:
    穷人思维与富人思维
    纯真IP库读取文件
    memcached 分布式 一致性hash算法demo
    纯CSS画的基本图形(矩形、圆形、三角形、多边形、爱心、八卦等)
    IPhone在横屏字体变大解决办法-webkit-text-size-adjust
    js设计模式---阅读笔记002--接口
    js设计模式---阅读笔记001--富有表现力的js
    关于js继承
    js正则表达式中test,exec,match方法的区别说明
    js获取自定义的属性值
  • 原文地址:https://www.cnblogs.com/quanhai/p/1715231.html
Copyright © 2011-2022 走看看