Use of ::Before and ::After | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Use of ::Before and ::After

What are some use cases for The pseudo elements Before and After? One might think you could creat custom bullet points for lists, but what else?

15th Apr 2019, 5:35 PM
Enoch Constantine Wu
Enoch Constantine Wu - avatar
2 Respuestas
0
As far I have seen it, before and after classes are mostly used to do rather complex styling like e.g. a arrow-shaped border at the bottom. They are generally used to reduce the amount of html tags, by using before and after like additional html elements. On regular websites however you will probably find them seldom...
15th Apr 2019, 6:45 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Like aaron said, its great for creating additional styling without having the additional html. Since you can have the content attribute, you can also add icons with before and after without actually having icons clutter your html. You can even transition before and after elements and by doing that you can create some pretty complex design from just a single element.
15th Apr 2019, 7:00 PM
Victor Andersson
Victor Andersson - avatar