element的height与width
关于一个element所有的高度宽度
- ele.style.width,ele.style.height:操纵style样式。+"px"
- offsetWidth、offsetHeight:获取对象相对于文档或者父元素offsetParent的宽度和高度,包含内边距、滚动条、边框。不包含外边距。
clientWidth、clientHeight:获取对象在窗口中所占的宽度和高度。只包含内边距。对于滚动部分不予计算。
scrollWidth、scrollHeight:是指元素的内容区域加上它的内边距和它的任何溢出部分,正好比clientWidth、clientHeigth多出溢出的部分。
offsetTop、offsetLeft:获取元素相对于文档或者父元素offsetParent的上、左坐标。
clientTop、clientLeft:一般而言没有意义,表示上边、左边的滚动条和边框的坐标。
scrollTop、scrollLeft:获取元素溢出的上边、左边距离。
注意:关于clientHeight,对于html元素来说,clientHeight is special,它返回浏览器可视区域的高度,不管页面有多高。http://help.dottoro.com/ljcadejj.php
关于获取浏览器高度的兼容写法见: http://www.cnblogs.com/fengzekun/p/3909557.html
element的height与width的更多相关文章
- CSS 笔记一(Selectors/ Backgrounds/ Borders/ Margins/ Padding/ Height and Width)
Selectors/ Backgrounds/ Borders/ Margins/ Padding/ Height and Width CSS Introduction: CSS stands for ...
- 关于CSS和JS中用到的各种Height和Width的问题
自己记不住,列一下关于CSS和JS中用到的各类有关Height和Width属性的介绍对比. 所属类别 属性名 意义 其他 浏览器模型 Screen.height 浏览器窗口所在的屏幕的高度(单位像素) ...
- HTML <img> 标签的 height 和 width 属性
定义和用法 <img> 标签的 height 和 width 属性设置图像的尺寸. 提示:为图像指定 height 和 width 属性是一个好习惯.如果设置了这些属性,就可以在页面加载时 ...
- UIView的frame的扩展分类,轻松取出x、y、height、width等值
一.引言: 在ios开发中,就界面搭建.控件布局时,都会很恶心的通过很长的代码才能取出控件的x.y.height.width等值,大大降低了开发效率.那为了省略这些恶心的步骤,小编在这里给UIView ...
- js获取height和width总结
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- screen.height && screen.width
screen.height && screen.width how to get window max width in js screen.height; screen.width; ...
- js获取图片信息(二)-----js获取img的height、width宽高值为0
首先,创建一个图片对象: var oImg= new Image(); oImg.src = "apple.jpg"; 然后我们打印一下图片的信息: console.log(oIm ...
- 如何获取Html的height和width属性(网页宽、高)
1.页面如图所示 2.Html代码 <div style="color:green;" id="html_info"></div> 3. ...
- 关于scroll、client、offset和style中的height、width、top以及bottom属性
内容和图片来自offset.scroll.client三大家族, 此处仅作记录使用 client offset scroll
随机推荐
- Count Primes ——LeetCode
Description: Count the number of prime numbers less than a non-negative number, n. 题目大意:给一个int,返回小于它 ...
- Remove Duplicates from Sorted List II ——LeetCode
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb ...
- WCF扩展系列 - 行为扩展(Behaviors)
原文地址:http://www.cnblogs.com/Creator/archive/2011/05/21/2052687.html 这个系列的第一部分将会重点关注WCF行为(behaviors), ...
- 如何在COM的IDL文件中include头文件?
可以使用import语句,如import "x.h"; 则在自动生成的xxx_i.h中将会有include "x.h", 于是x.h就被include到工程中了 ...
- [Locked] Count Univalue Subtrees
Count Univalue Subtrees Given a binary tree, count the number of uni-value subtrees. A Uni-value sub ...
- Swap[HDU2819]
SwapTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission ...
- Solr与mmseg4J的整合
Solr与mmseg4j部署 一. solr安装 1. 下载solr http://www.apache.org/dyn/closer.cgi/lucene/solr/ 2. apache-sol ...
- Linux设备驱动编程之复杂设备驱动
这里所说的复杂设备驱动涉及到PCI.USB.网络设备.块设备等(严格意义而言,这些设备在概念上并不并列,例如与块设备并列的是字符设备,而PCI.USB设备等都可能属于字符设备),这些设备的驱动中又涉及 ...
- [转] STL源码学习----lower_bound和upper_bound算法
http://www.cnblogs.com/cobbliu/archive/2012/05/21/2512249.html PS: lower_bound of value 就是最后一个 < ...
- AutoBackupForApps
This sample demonstrates how to selectively disable Automatic Backups in Android M, either by adjust ...