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
  • 1,737
  • 6
  • 19
  • 33

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
  • 17,612
  • 12
  • 55
  • 87