wildcard * in CSS for classes

前端 未结 4 1978
忘掉有多难
忘掉有多难 2020-11-22 10:58

I have these divs that I\'m styling with .tocolor, but I also need the unique identifier 1,2,3,4 etc. so I\'m adding that it as another class tocolor-1

4条回答
  •  甜味超标
    2020-11-22 11:18

    Yes you can this.

    *[id^='term-']{
        [css here]
    }
    

    This will select all ids that start with 'term-'.

    As for the reason for not doing this, I see where it would be preferable to select this way; as for style, I wouldn't do it myself, but it's possible.

提交回复
热议问题