Is it possible to use a CSS wildcard in the middle of an attribute selector?

前端 未结 1 2053
离开以前
离开以前 2020-11-28 08:56

I have some generated CSS and would like to use some css that could select e.g.

Text

相关标签:
1条回答
  • 2020-11-28 09:10

    You can't use a wildcard like that, but to get the desired result (ID starts with lorem and ends with Ipsum) you can use the attribute starts-with and ends-with selectors instead, like so:

    p[id^="lorem"][id$="Ipsum"]
    

    Remember that by linking multiple attribute selectors like this (along with the p type selector), you're doing an AND match with all of them on the same element.

    jsFiddle demo

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