首先是MDN
:https://developer.mozilla.org/zh-CN/docs/Web/CSS/Attribute_selectors
然后是场景:
此处需要将所有包含overflow: scroll
行内样式(也就是元素的style
属性内写样式)的元素,设置为overflow:auto
代码:
*[style*='overflow: scroll'] {
overflow: auto !important;
}
a {
color: blue;
}
/* 以 "#" 开头的页面本地链接 */
a[href^="#"] {
background-color: gold;
}
/* 包含 "example" 的链接 */
a[href*="example"] {
background-color: silver;
}
/* 包含 "insensitive" 的链接,不区分大小写 */
a[href*="insensitive" i] {
color: cyan;
}
/* 包含 "cAsE" 的链接,区分大小写 */
a[href*="cAsE" s] {
color: pink;
}
/* 以 ".org" 结尾的链接 */
a[href$=".org"] {
color: red;
}