获得徽章 0
- html {
--logic: if (x > 5) document.body.style.background = "blue";
}
CSS自定义属性写入 JS 逻辑语句也是合法的,因此,理论上,配合点 JS,是可以实现 CSS 中写 JS 代码功能的。展开评论2 - 如果不考虑兼容性,返回字符的 unicode 值肯定是使用 codePointAt 方法,而不是 charCodeAt,因为字符值不小于 65536 的 Unicode值获取更方便,直接char.codePointAt(0).toString(16)。19