I'm trying to add a custom CSS file when a Magento action is loaded.

My layout page is as follows :

<layout version="0.1.0">

  <reference name="head">

        <action method="addCss">
       <reference name="root">
         <block type="page/html" name="root"  output ="toHtml" template = "mypage.phtml"/>



The content of mypage.phtml displays without a problem but the CSS is not loaded. The path to my css is :



2 Answers 2


The path to the stylesheet directory will depend on what you have set in System=>Configuration=>General=>Design=>Themes=>Skin (Images / CSS) so depending on what you have set there, it will look in that directory for the CSS file.

You can easily find out where Magento is looking for that stylesheet by going on the frontend of the website and looking at the console log, there should be a 404 for the custom.css file.

Always make sure to flush your cache when you make layout changes

  • The skin config is empty ,i'm using default magento install with sample data. And i see not 404 error for the css file in the console.
    – mockingbid
    Nov 21, 2018 at 17:29
  • did you flush/clear the cache?
    – Haim
    Nov 21, 2018 at 17:30
  • Use i deleted the var cache folder and i have already disabled all cache
    – mockingbid
    Nov 21, 2018 at 17:32
  • did you try <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action>
    – Haim
    Nov 21, 2018 at 17:39
  • It didn't work. Same result :/
    – mockingbid
    Nov 21, 2018 at 17:48

you can try below code this code work for me

<reference name="head">
    <action method="addItem">

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.