document.querySelector('.red').style.color = 'red'
或使用 "css"
:nth-child(1 of .red) {
color: red;
}
/** 以及最后一个 */
:nth-last-child(1 of .red) {
color: blue;
}
兼容性感人:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241013/1056526da353d9f3daf7fb21f1ee984f.png)