What is the use of (:focus)pseudo class in css | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of (:focus)pseudo class in css

Difference between :focus pseudo class and other pseuso selector

27th May 2020, 7:19 AM
THE CRAZY ONE ✌️
THE CRAZY ONE ✌️ - avatar
5 Answers
+ 3
The use of it is to add a style to the focsed html inputs / form. Example: https://code.sololearn.com/W2CgW3Hvb947/?ref=app the difference would be that.. umm-_ I think it only works on forms. It won’t work on <div>, <p>, ...
27th May 2020, 7:37 AM
Ginfio
Ginfio - avatar
+ 1
Ginfio Is this only used in html inputs/forms ?
27th May 2020, 7:41 AM
THE CRAZY ONE ✌️
THE CRAZY ONE ✌️ - avatar
+ 1
HRITIK.DIYUNDI yeah, I think so. as far as I know, :focus is used foe inputs, forms.
27th May 2020, 7:44 AM
Ginfio
Ginfio - avatar
+ 1
Ginfio okk and Thanks for help🙂
27th May 2020, 7:45 AM
THE CRAZY ONE ✌️
THE CRAZY ONE ✌️ - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 and the other pseudo selector
27th May 2020, 7:42 AM
THE CRAZY ONE ✌️
THE CRAZY ONE ✌️ - avatar