How to write a:hover in inline CSS?

后端 未结 23 2580
孤城傲影
孤城傲影 2020-11-21 23:15

I have a case where I must write inline CSS code, and I want to apply a hover style on an anchor.

How can I use a:hover in inline CSS inside the HTML st

23条回答
  •  北荒
    北荒 (楼主)
    2020-11-21 23:45

    You can't do exactly what you're describing, since a:hover is part of the selector, not the CSS rules. A stylesheet has two components:

    selector {rules}
    

    Inline styles only have rules; the selector is implicit to be the current element.

    The selector is an expressive language that describes a set of criteria to match elements in an XML-like document.

    However, you can get close, because a style set can technically go almost anywhere:

    
      
      hello
    
    

提交回复
热议问题