- 相關(guān)推薦
jQuery設(shè)置CSS屬性的示例及介紹
設(shè)置 CSS 屬性
如需設(shè)置指定的 CSS 屬性,請使用如下語法:
復(fù)制代碼 代碼如下:
css("propertyname","value");
下面的例子將為所有匹配元素設(shè)置 background-color 值:
實例
復(fù)制代碼 代碼如下:
$("p").css("background-color","yellow");
設(shè)置多個 CSS 屬性
如需設(shè)置多個 CSS 屬性,請使用如下語法:
復(fù)制代碼 代碼如下:
css({"propertyname":"value","propertyname":"value",...});
下面的例子將為所有匹配元素設(shè)置 background-color 和 font-size:
實例
復(fù)制代碼 代碼如下:
$("p").css({"background-color":"yellow","font-size":"200%"});
【jQuery設(shè)置CSS屬性的示例及介紹】相關(guān)文章:
css屬性定位教程07-23
關(guān)于jQuery實現(xiàn)高亮顯示的方法介紹08-20
asp.net+jquery Jsonp使用方法介紹08-23
jQuery程序設(shè)計08-05
jquery提交按鈕的代碼07-28
CSS最核心的概念03-10
CSS入門教程01-25
架子鼓的設(shè)置方法介紹09-24