jQuery获取或设置元素的宽度和高度

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() 方法设置或返回元素的高度(包括内边距和边框)。
posted @ 2018-11-29 15:45  ArvinCQJ  阅读(15581)  评论(1编辑  收藏  举报