Trusted answers to developer questions

What is an active selector?

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

An active selector is used to style and select an active link.

It can be used to change the attributessuch as the background color or font size, of a highlighted link once that link has had some action done on it.

The syntax is:

 TAG:action TAG NAME:active{
//enter the properties you want to change
}

The actions can be any acceptable action (e.g., hover or visited). These actions can help with user accessibility. For example, if a link has been visited it will change color to distinguish itself from those links the user has not yet visited.

Here is an example of how this property can be used:

Now, when a user hovers over “Hello and welcome to educative”, it changes color to a yellow background.

In the case of multiple tags in a given file, we can use the class names to distinguish. In that case, we add TAG.Classname:active to make that particular tag active. Here is an example:

In this case, only the “Hello” changes color when a user hovers over the link.

RELATED TAGS

css

CONTRIBUTOR

Fahad Farid
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?