I need to create custom.css file using local.xml. I tried adding this command <action method="addCss"><stylesheet>css/custom.css></stylesheet></action> to local.xml file but it doesn't do anything, I can't edit my page. I'm not even sure where the custom.css saves. Could somone tell me the steps to do this with paths to the files?


What @kothari posted will work, but since I can't comment on his answer, I'll answer your question about where it looks for it here.

Basically what this does:

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

Is it tells Magento to add the CSS in this file path:


$package and $theme referring to the active package and theme. For example, if you're using the default base theme, this would resolve to:


It does NOT create the CSS file for you, you have to create that CSS file and add it to that folder.


Try this, in your local.xml

         <reference name="head">
             <action method="addCss"><stylesheet>css/custom.css</stylesheet></action>
  • Thank you, but I can't find it. Do I need to create it? and if so whats the path? – Rufas Dec 14 '16 at 19:57
  • First check page source it will call or not – Magento 2 Dec 15 '16 at 4:34

Adding new CSS


<?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/newtheme.css" />

Remove static resources (JavaScript, CSS, fonts) To remove the static resources, linked in a page , make a change similar to the following in a theme extending file app/design/frontend///Magento_Theme/layout/default_head_blocks.xml

    <!-- Remove local resources -->
    <remove src="css/styles-m.css" />
    <remove src="my-js.js"/>
    <remove src="Magento_Catalog::js/compare.js" />

<!-- Remove external resources -->
    <remove src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"/>
    <remove src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"/>
    <remove src="http://fonts.googleapis.com/css?family=Montserrat" /> 


  • the question is for M1.9 but your answer is for M2 – fmsthird Mar 27 at 5:58

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.