Question

In Magento 1 we can add inline CSS from admin Layout Update XML like this :

<reference name="head">
 <block type="core/text" name="custom_css">
  <action method="setText">
      <text><![CDATA[
         <style  type="text/css">
            .my-class  {
                color: red;
            }
         </style> ]]>
    </text>
  </action>
 </block>
</reference>

how can this be implemented in Magento 2 admin Layout Update XML?

I've tried it in Magento 2.2 but it did not work

Was it helpful?

Solution

This is not currently possible in Magento 2. You can add in CSS classes with XML (the example that @Christoph Farnleitner), but not actual CSS itself.

OTHER TIPS

A little bit tricky, in the inside content field you can use like this :

<style xml="space"><!--
/* your css snippet here */
--></style>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top