Shorthand css 和 jQuery?
Shorthand css with jQuery?
我想知道 jQuery。我试图更改 Div 的边框。如果我逐步更改边框,效果很好。但是 shorthand CSS 不起作用。
一个例子:
// Works well
$(div).css({
'border-color': '#000000',
'border-width': '10px'
});
// But this does not work:
$(div).css({
'border': '10px solid #000000'
});
有没有办法使用 shorthand CSS 样式或者不支持这种样式?
当利用 .css()
设置单个 属性 尝试设置时不使用对象符号
$(div).css("border", "10px solid #000000");
我想知道 jQuery。我试图更改 Div 的边框。如果我逐步更改边框,效果很好。但是 shorthand CSS 不起作用。
一个例子:
// Works well
$(div).css({
'border-color': '#000000',
'border-width': '10px'
});
// But this does not work:
$(div).css({
'border': '10px solid #000000'
});
有没有办法使用 shorthand CSS 样式或者不支持这种样式?
当利用 .css()
设置单个 属性 尝试设置时不使用对象符号
$(div).css("border", "10px solid #000000");