美文网首页JQuery饥人谷技术博客Web前端之路
jQuery之height()、innerHeight()、ou

jQuery之height()、innerHeight()、ou

作者: 匿名用户404 | 来源:发表于2017-08-09 22:09 被阅读53次

在jQuery中,获取元素高度的函数有3个,它们分别是height()、innerHeight()、outerHeight()
与此相对应的是,获取元素宽度的函数也有3个,它们分别是width()、innerWidth()、outerWidth()

下面我以height()、innerHeight()、outerHeight()三个函数为例,以元素element的盒模型为例来介绍它们之间的区别。
Paste_Image.png
函数 高度范围
height() content
innerHeight() content+padding
outerHeight() content+padding+border
outerHeight(true) content+padding+border+margin
只有height()函数可用于window或document对象。

相关文章

网友评论

本文标题:jQuery之height()、innerHeight()、ou

本文链接:https://www.haomeiwen.com/subject/isxcrxtx.html