How can we add custom CSS file in the Magento 2 application globally or on the specific pages i.e Product page or Checkout page?
Thanks
How can we add custom CSS file in the Magento 2 application globally or on the specific pages i.e Product page or Checkout page?
Thanks
2
Answers
Yes, you can. Check it in documentation: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css-themes.html#fedg_css-in-themes_xml, example:
To add custom CSS to your module you need to include css in your Layout XML file under section.
To include css globally, add it to default.xml or for specific file add it to your desired file (ex. catalog_category_view.xml)
Code to add in XML file:
Now you need to create a css file which you defined in your XML file.
Create CSS file at app/code/vendorName/moduleName/view/frontend/web/css/yourcssfilename.css
yourcssfilename.css
Run below commands and check: