qwertylpc
qwertylpc

Reputation: 2106

Pseudo-class in html

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

Upvotes: 1

Views: 44

Answers (1)

nicael
nicael

Reputation: 18997

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).

Upvotes: 2

Related Questions