ITPub博客

首页 > IT职业 > IT职场 > jQuery之height()、innerHeight()、outer

jQuery之height()、innerHeight()、outer

IT职场 作者:m53469 时间:2021-09-09 09:37:17 0 删除 编辑

在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对象。



作者:匿名用户404
链接:https://www.jianshu.com/p/fc5a4a3bccba

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2819/viewspace-2805277/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-19

  • 博文量
    80
  • 访问量
    13444