+ 7

how is ::before and ::after is used?

what property and value will I use? Thanks!

2nd Jun 2017, 8:39 PM
Dipti Muni
Dipti Muni - avatar
4 Antworten
+ 17
::before specifies some content before a specific element ::after specifies some content after a specific element DEMO example: https://code.sololearn.com/W94d74k0ec4Y/?ref=app You can use them, for example... to add some icon in an input text, Font Awesome requires ::before/::after for insert some icons from CSS code, just an example. :)
2nd Jun 2017, 9:26 PM
Maz
Maz - avatar
+ 12
Maz is right. ::before & ::after is css tricks(called Psuedo-class) They have cotent property. You can add text or image with content property. + PS They were :before and :after in CSS2. ::before and ::after is for CSS3. It does not make a problem but you cant use :before and :after if IE version is lower than IE8.
2nd Jun 2017, 11:04 PM
김정제(Legacy)
김정제(Legacy) - avatar
+ 4
::before and ::after can even be manipulated for neat effects (follow the orange and blue dots; those are the psuedo-elements: https://code.sololearn.com/WLZFqkui99gM/?ref=app Here, I'm using them while counting: https://code.sololearn.com/WeJGJ90zAZUW/?ref=app
3rd Jun 2017, 2:48 PM
Kirk Schafer
Kirk Schafer - avatar
0
The ::before and ::after pseudo classes can be used to create a step wise fill form for users of a website. Have you ever noticed on most sites where you see, "step 1, step..."? Your before and after helps you a lot in that. You could also use them to create chat boxes that have some kind of pointed end at one side. In all, you just need to think out of the box when you use them.
14th Apr 2018, 5:36 AM
Bless Darah Gah
Bless Darah Gah - avatar