Is it possible to add individual CSS file on each cms page? Upon researching, I can do it by adding code on Layout update XML.

Unfortunately, it isn't working. Here's my code:

  <css src="Namespace_YourModule::css/styles.css"/>

enter image description here

  • Shall i know what is the scenario you need? – Rama Chandran M Jul 4 '17 at 13:20
  • i want to add css file on a specific cms page, in magento 1 here is the code <reference name="head"> <action method="addCss"> <stylesheet>css/custom.css</stylesheet> </action> </reference> i'm not sure on magento 2 – Richmond Azarraga Jul 4 '17 at 13:23
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <css src="css/mycustom.css" after="-" />

If you're on < version 2.1.9 there was apparently a bug to prevent this from working, I've never tried it but you can read about it here - Adding CSS to a CMS page using Layout Update XML

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.