用JS给页面添加CSS

By | 2022-09-29
//只用JS添加CSS
var styles = `
    .btn_c#addToCart{background:blue}
`
var styleSheet = document.createElement("style")
styleSheet.innerText = styles
document.body.appendChild(styleSheet)