随记-CSS对元素进行属性选择匹配

截屏2026-11-15 15.13.13

 


示例代码:

span[title="JavaScript"] {
    color: yellow;
}
span[title~="backbone"] {
    color: grey;
}
span[title*="safety-and-perf"] {
    color: indigo;
}
span[title^="python" i] {
    color: skyblue;
}
span[title$="Go."] {
    color: crimson;
}
span[title|="TypeScript"] {
    color: #3178c6;
}
<span title="JavaScript">JS</span>

<span title="The durable backbone of enterprise systems: Java.">Java</span>

<span title="Rust is the safety-and-performance choice for systems programming.">Rust</span>

<span title="Python is the accessible gateway to AI and data.">Python</span>

<span title="The pragmatic language of cloud-native infrastructure: Go.">Go</span>

<span title="TypeScript-Language is the engineering standard for large-scale frontends.">TS</span>

 

posted @ 2026-11-15 15:11  樊顺  阅读(6)  评论(0)    收藏  举报