当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 关于jquery css的使用介绍

关于jquery css的使用介绍

2019年01月15日  | 移动技术网IT编程  | 我要评论

jquery 操作 css

  • addclass() - 向被选元素添加一个或多个类
  • removeclass() - 从被选元素删除一个或多个类
  • toggleclass() - 对被选元素进行添加/删除类的切换操作
  • css() - 设置或返回被选元素的一个或多个样式属性。

jquery css() 方法

〈1〉返回 css 属性

css("propertyname");

〈2〉设置 css 属性

css("propertyname","value");

〈2.1〉设置多个 css 属性

css({"propertyname":"value","propertyname":"value",...});

jquery 尺寸 方法

jquery 提供多个处理尺寸的重要方法:

  • width() 设置或返回元素的宽度(不包括内边距、边框或外边距)。
  • height() 设置或返回元素的高度(不包括内边距、边框或外边距)。
    设置:$("#p1").width(500).height(500); more : $(window/document).width/height;
  • innerwidth() 返回元素的宽度(包括内边距)。
  • innerheight() 返回元素的高度(包括内边距)。
  • outerwidth() 返回元素的宽度(包括内边距、边框和外边距)。
  • outerheight() 返回元素的高度(包括内边距、边框和外边距)。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网