繁体   English   中英

DOM 内联样式 - 无法识别 backgroundColor 属性

[英]Inline styling with DOM - backgroundColor property not being recognised

为什么按钮的背景没有变成蓝色?

 but.style.setProperty('height', '200px'); but.style.setProperty('backgroundColor', 'blue');
 <button id="but">I am a button</button>

它的background-color 来源

 but.style.setProperty('height', '200px'); but.style.setProperty('background-color', 'blue');
 <button id="but">I am a button</button>

使用background-color css 属性

 but.style.setProperty('height', '200px'); but.style.setProperty('background-color', 'blue');
 <button id="but">I am a button</button>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM