body style height 50pt link rel stylesheet href https cdnjs cloudflare com ajax libs font awesome 4 7 0 css font awesome min css crossorigin anonymous i class fa fa car i i class fa fa car style font size 48px i i class fa fa car style font size 60px color red i body body style height 50pt link rel stylesheet href https cdnjs cloudflare com ajax libs font awesome 5 15 3 css all min css crossorigin anonymous i class fa fa bullseye i i class fab fa hubspot style font size 48px i i class fas fa car style font size 60px color red i body Font Awesome 5 is the fas prefix Font Awesome 4 uses fa var link document createElement link link rel stylesheet link type text css link href https cdnjs cloudflare com ajax libs font awesome 4 7 0 css font awesome min css link media all document head appendChild link document body style height 100pt link onload function let ii document createElement i ii className fa fa car ii style font size 48pt document body appendChild ii console log finished Font Awesome 5 is the fas prefix Font Awesome 4 uses fa var link document createElement link link rel stylesheet link type text css link crossOrigin anonymous link href https cdnjs cloudflare com ajax libs font awesome 5 15 3 css all min css link media all document head appendChild link document body style height 50pt fa fab fad fal far fas link onload function let ii document createElement i ii className fas fa car ii style font size 48pt document body appendChild ii console log finished Font Awesome 5 is the fas prefix Font Awesome 4 uses fa var link document createElement link link rel stylesheet link type text css link crossOrigin anonymous link href https cdnjs cloudflare com ajax libs font awesome 5 15 3 css all min css link media all document head appendChild link document body style height 450pt fa fab fad fal far fas link onload function console log document styleSheets console log num sheets document styleSheets length console log rules document styleSheets 0 cssRules length let cssRules document styleSheets 0 cssRules let iconNames for let key in cssRules let cssText cssRules key cssText if typeof cssText undefined continue if cssText indexOf before content 0 let name cssText substring 4 cssText indexOf console log name iconNames push name console log iconNames length have all the icon names in iconNames however they have different prefix details for version 5 i e fa fab fas if they re solid outline etc for testing here just do them all debug see them all for let bb 0 bb 6 bb let val fa fab fad fal far fas let pre val bb let div document createElement div document body appendChild div div style position absolute div style left 10px div style top 30px div style right 10px div style bottom 10px for let n 0 n 800 n console log iconNames n let ii document createElement i fa fab fad fal far fas ii className pre fa iconNames n e g fa fa car ii style border 1px solid blue ii style font size 16pt ii style width 18pt ii style height 18pt ii title iconNames n div appendChild ii end for n end bb just for testing specific icon let ii document createElement i fa fab fad fal far fas ii className fab fa hubspot ii style border 1px solid blue ii style font size 16pt ii title fab fa hubspot document body appendChild ii just for testing specific icon let ii document createElement i fa fab fad fal far fas ii className fab fa app store ios ii style border 1px solid blue ii style font size 16pt ii title fab fa app store ios document body appendChild ii end onload console log finished
num sheets document styleSheets length console log rules document styleSheets 0 cssRules length let cssRules document styleSheets 0 cssRules let iconNames for let key in cssRules let cssText cssRules key cssText if typeof cssText undefined continue if cssText indexOf before content 0 let name cssText substring 4 cssText indexOf console log name iconNames push name console log iconNames length have all the icon names in iconNames however they have different prefix details for version 5 i e fa fab fas if they re solid outline etc for testing here just do them all debug see them all for let bb 0 bb 6 bb let val fa fab fad fal far fas let pre val bb let div document createElement div document body appendChild div div style position absolute div style left 10px div style top 30px div style right 10px div style bottom 10px for let n 0 n 800 n console log iconNames n let ii document createElement i fa fab fad fal far fas ii className pre fa iconNames n e g fa fa car ii style border 1px solid blue ii style font size 16pt ii style width 18pt ii style height 18pt ii title iconNames n div appendChild ii end for n end bb just for testing specific icon let ii document createElement i fa fab fad fal far fas ii className fab fa hubspot ii style border 1px solid blue ii style font size 16pt ii title fab fa hubspot document body appendChild ii just for testing specific icon let ii document createElement i fa fab fad fal far fas ii className fab fa app store ios ii style border 1px solid blue ii style font size 16pt ii title fab fa app store ios document body appendChild ii end onload console log finished