Magento – How to add custom css file in luma theme magento 2

magento2

I have used Magento 2 with luma Theme.
I have custom design for theme. I want to add one custom.css file in site.

Best Answer

Create <your-theme-directory>/Magento_Theme/layout/default_head_blocks.xml

Add the following:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/your-css-file.css" />
    </head>
</page>

See the dev docs for more info - https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-topics/css-themes.html

Related Topic