jq的css方法

读属性:

$(selector).css(name)

设置属性:

法一:

$(selector).css(name,value)

法二:

$(selector).css(name,function(index,value))

$("div").click(function() {
  $(this).css(
    "width", function(index, value) {return parseFloat(value) * 1.2;}
  );

});

法三:

$(selector).css({property:value, property:value, ...})


$("p").css({
  "color":"white",
  "background-color":"#98bf21",
  "font-family":"Arial",
  "font-size":"20px",
  "padding":"5px"
  });
原文地址:https://www.cnblogs.com/yaoyao-sun/p/10400383.html