DEV Community

Discussion on: Do you use CSS ::before and ::after pseudo elements?

Collapse
 
mr21 profile image
Thomas Tortorini • Edited

If you are meticoulous and don't want to create a full HTML element just for an icon, then you'll end up using ::before a lot. Imagine you have an handle area for dragndrop, then in the center of this handle area you'll add something like (fontawesome.com/icons/grip-lines?s...), then you can add it via ::before and use content: "\f7a4"; instead of adding a <i> element which is consist to adding HTML just for styling and this should not be accepted.

Collapse
 
brob profile image
Bryan Robinson

That's a great use case. It's honestly the main use case that makes me miss using FontAwesome regularly. Tossing that entity in an ::after element is so easy! Love it!