cqj98k
jQuery获取或设置元素的宽度和高度:
可使用以下3种方法:
1,jQuery width() 和 height() 方法;
2,innerWidth() 和 innerHeight() 方法;
3,outerWidth() 和 outerHeight()方法。
 
jQuery width() 和 height() 方法,innerWidth() 和 innerHeight() 方法,outerWidth() 和 outerHeight() 方法的区别如下:
一、jQuery width() 和 height() 方法
width() 方法设置或返回元素的宽度(不包括内边距、边框或外边距)。
height() 方法设置或返回元素的高度(不包括内边距、边框或外边距)。
 
二、jQuery innerWidth() 和 innerHeight() 方法
innerWidth() 方法设置或返回元素的宽度(包括内边距)。
innerHeight() 方法设置或返回元素的高度(包括内边距)。
 
三、jQuery outerWidth() 和 outerHeight() 方法
outerWidth() 方法设置或返回元素的宽度(包括内边距和边框)。
outerHeight() 方法设置或返回元素的高度(包括内边距和边框)。

分类:

技术点:

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-12-25
  • 2021-12-25
  • 2022-01-08
  • 2021-06-02
猜你喜欢
  • 2022-01-08
  • 2021-11-14
  • 2021-12-26
  • 2022-12-23
  • 2021-12-14
  • 2021-11-30
  • 2022-01-08
相关资源
相似解决方案