I'm new to Magento 2.
I would like to know how to use font awesome icons in my magento 2 project particularly in linking the cdn url to my project where about would I add this link?
Thanks
You have to use absolute url instead of relative url to import font in css file like :
../font/fontfilename => http://www.yourdomain/skin/frontend/namespace/theme/font/fontfilename
To add external static resources like CSS, JavaScript, Web fonts (Fontawesome in this case), Please follow the steps below.
Go to this link and copy the CDN URL of Fontawesome.
Find the file app/design/frontend/{Themevendor}/{Themename}/Magento_Theme/layout/default_head_blocks.xml
and paste the line below. (The line should be placed in the head
tag and the value of src_type
should be url
.)
<css src="https://use.fontawesome.com/releases/v5.2.0/css/all.css" src_type="url"/>
For details please visit this Magento 2 devdocs link