jQuery 设置 CSS 属性示例介绍
如需设置指定的 CSS 属性,请使用如下语法:
css("propertyname","value");
下面的例子将为所有匹配元素设置 background-color 值:
实例
$("p").css("background-color","yellow");
设置多个 CSS 属性
如需设置多个 CSS 属性,请使用如下语法:
css({"propertyname":"value","propertyname":"value",...});
下面的例子将为所有匹配元素设置 background-color 和 font-size:
实例
$("p").css({"background-color":"yellow","font-size":"200%"});
您可能感兴趣的文章:
jQuery 设置 CSS 属性示例介绍
jQuery设置CSS属性(示例)
html5 border属性怎么设置?html5 table中的border属性介绍
jQuery获得内容与属性方法
jQuery css() 方法
jQuery元素属性attr设置多个键值的例子
jquery show()方法与hide()方法的小例子
jquery如何设置元素readonly与disabled属性
jQuery - css() 方法示例详解
JS与jquery自定义属性用法