来源:https://www.w3school.com.cn/js/js_htmldom_css.asp
1,
document.getElementById(id).style.property = new style
<html> <body> <p id="p2">Hello World!</p> <script> document.getElementById("p2").style.color = "blue"; </script> <p>上面的段落已被脚本改变。</p> </body> </html>