+ 7

what does a:active do in CSS?

2nd Sep 2020, 5:15 AM
Noob Programmer
Noob Programmer - avatar
4 ответов
+ 3
Abir Sheikh It is a pseudoclass that can be applied to a focusable element just like other pseudoclasses, hover and focus. These are usually used to visually differentiate different states of a focusable element by applying different styles. For example, I want a button element to have different background colours to indicate different states. CSS -------------- button{ background: #ddd; } button:hover{ background: orange; } button:focus{ background: red; } button:active{ background: green; } --------------- See this page: https://developer.mozilla.org/en-US/docs/Web/CSS/:active
2nd Sep 2020, 6:18 AM
Hanuma Ukkadapu
Hanuma Ukkadapu - avatar
+ 4
This is a pseudoclass like hover but this works when you Click
2nd Sep 2020, 5:19 AM
Muhammadamin
Muhammadamin - avatar
0
Hey there! As mentioned by Muhammadamin , it is a pseudoclass. Using this you can style the active link differently than the others in the same segment. Eg: In a navigation bar, the tab that is currently opened is often styled differently than the other tabs.
2nd Sep 2020, 5:55 AM
Vatsal Sharma
Vatsal Sharma - avatar
- 1
Selects active links.
2nd Sep 2020, 5:57 AM
Sonic
Sonic - avatar