0

In Magento 2, there is a box to place custom CSS to any block. enter image description here

However, I don't see that as an option in Magento 1 enter image description here

How do I add custom CSS to a block in Magento 1?

Edit for possible dupe: I want to know how to just add some css to a block, is there not a way to just do that in Magento 1? Do I have to create a custom css and layout class for every block? If that is the case, can I have someone explain a little more clearly how to do this?

Edit for comments: It won't save an in file style block enter image description here enter image description here

6
  • 1
    Possible duplicate of Custom css for custom block/phtml.
    – MagenX
    Jun 4, 2019 at 16:37
  • do not use magento interface for css updates, create custom css file with custom path and keep all your changes.
    – MagenX
    Jun 4, 2019 at 16:38
  • I looked at that question but I don't really understand the answer Jun 4, 2019 at 16:45
  • Why does the interface exist if I'm not suppose to use it? Jun 4, 2019 at 16:46
  • You can directly add css using <style> tag
    – Pawan
    Jun 4, 2019 at 17:17

1 Answer 1

1

Not exactly same as M2 but you can do it via Design tab > Layout as XML

So edit CMS page, add XML entry to Lauout as XML. Make sure your js and css is in place and you have following options.

https://www.rowanburgess.co.uk/add-css-javascript-files-cms-pages-magento/

To add a CSS file residing in the skin CSS folder

<default>
   <reference name="head">
      <action method="addCss">
         <stylesheet>css/custom.css</stylesheet>
      </action>
   </reference>
</default>

To add a Javascript file residing in the skin JS folder

<default>
   <reference name="head">
      <action method="addItem">
         <type>skin_js</type>
         <name>js/custom.js</name>
         <params/>
      </action>
   </reference>
</default>

To add a Javascript file residing in the {magentoroot}/js folder

<default>
   <reference name="head">
      <action method="addJs">
         <script>custom.js</script>
      </action>
   </reference>
</default>

For blocks you will need extension

Someone posted this online

https://github.com/progammer-rkt/magento-js-css-for-static-blocks

Cant say for certain it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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