Magento 2 – How to Add Custom CSS Files into the Head

layoutmagento2xml

In Magento 1.x, I can add the CSS files into the head using the helper
like below code.

<reference name="head">
    <action method="addCss"><stylesheet helper="module/helperclass/helperfunction"/></action>
</reference>

Anyone know how to do this in Magento 2?

Best Answer

You don't need helper, you can using this code below in your layout:

<head>
    <css src="Namespace_YourModule::css/styles.css"/>
</head>
Related Topic