jQuery - css() 方法樣本詳解

來源:互聯網
上載者:User

 css()方法設定或返回被選元素的一個或多個樣式屬性,下面有幾個不錯的樣本,大家可以感受下

 設定 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%"});  
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.