How to add custom css file in Magento 2?

You need to follow the below steps:

Step 1:
Create default_head_blocks.xml like below:


Step 2:
Andd create local.css like below


Step 3:
Add the below code to default_head_blocks.xml

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
    <css src="css/local.css" />

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *