1

I currently have something like this in my css file:

a:active {
    color: purple;
}

p {
    color: pink;
}

and now I want to incorporate that into solely the HTML.

For the p it is easy, I would just have

<p style = "color: pink">Foo</p>

My question is how do I incorporate the pseudo-classes into the actual html

qwertylpc
  • 2,016
  • 7
  • 24
  • 34

1 Answers1

2

You can't. The CSS for pseudo-classes can be assigned either with CSS or with JavaScript events (click, mouseover, etc), but not directly with HTML.

However, you could do that with, for example, onmousedown="func()", would and set the styles with func(); would be same as setting it via CSS with :active pseudo-class).

nicael
  • 18,550
  • 13
  • 57
  • 90