What CSS selector finds elements based on attribute values, regardless of attribute names?

前端 未结 1 1590
离开以前
离开以前 2021-01-27 19:10

For example, in the elements below, what selector would find everything with a value of \"value2\", regardless of the attribute\'s name?

1条回答
  •  爱一瞬间的悲伤
    2021-01-27 19:41

    May I suggest having a specific attribute and then searching that specific attribute value?

    HTML

    CSS

    [data-name^='value2'] {
        background-color:red;
    }
    

    0 讨论(0)
提交回复
热议问题