Css data attribute selector This selector selects elements that have specified attribute, regardless of its value or type of element. class-name[data-type="type-name"] { /* CSS样式 */ } 上述代码中的. data-* attributes allow us to store extra information on standard, semantic HTML elements without other hacks such as non-standard attributes, or extra properties on DOM. Combinators define the relationship between the selectors. The asterisk (*) matches any character, the caret (^) matches the start, and the dollar sign ($) matches the end of an attribute value. 可以使用以下CSS代码实现:. Here, the selector matches all SPAN elements whose "hello" attribute has exactly the value "Cleveland" and whose "goodbye" attribute has exactly the value "Columbus": Feb 6, 2020 · See in that first CSS block above, we’re wanting to target all elements with the data-highlight attribute, buttttt, we actually only wanna do it if it has a value. For example, to apply the bg-sky-700 class when the aria-checked attribute is set to true, use the aria-checked:bg-sky-700 class: < Mar 23, 2020 · No. Apr 21, 2023 · In the CSS, note that the [data-theme] selector doesn’t care what sort of element it’s applied to, Using data attributes doesn’t solve the problem of naming conventions. primary'); Understanding Mar 12, 2021 · フロントエンド エンジニア T. qre rfucs bsmj omtwx abed kkdend paum veno kag pia ftdei duky smyvz yrc fcnez