CSS selector for element within element with inline style?

后端 未结 4 748
滥情空心
滥情空心 2021-02-02 10:26

Is there a CSS selector to target elements with inline styles? So can I target the first span but not the 2nd with CSS only?

If not, can this be done with jQuery?

4条回答
  •  不要未来只要你来
    2021-02-02 10:42

    If you would like to apply styles to a particular rule declaration you can also use style*. This will match all elements that have the inline style, regardless of the value applied.

    div[style*="background-image"] {
      background-size: cover;
      background-repeat: no-repeat;
    }
    

提交回复
热议问题