I wanted to change the css for the default theme. I thought the right thing to do would be to add/override styles in custom.css. Looking at page.xml, I found that by default, custom.css isn’t ever loaded. So, I added a load of custom.css to a copy of page.xml stored in my theme’s directory.
BUT…
1) Do I really have to copy all of page.xml just to add one addCss command? I was hoping there would be a way to reference the default page.xml with just my little add
2) Is this really the best way to make css changes? I’m trying to create my theme as the absolute smallest set of changes to the default theme in order to keep my site as upgradable as possible.
I wanted to change the css for the default theme. I thought the right thing to do would be to add/override styles in custom.css. Looking at page.xml, I found that by default, custom.css isn’t ever loaded. So, I added a load of custom.css to a copy of page.xml stored in my theme’s directory.
BUT…
1) Do I really have to copy all of page.xml just to add one addCss command? I was hoping there would be a way to reference the default page.xml with just my little add
2) Is this really the best way to make css changes? I’m trying to create my theme as the absolute smallest set of changes to the default theme in order to keep my site as upgradable as possible.
Hello there,
I just saw your message and I must say I suffered since I modified heavily the “boxes.css” of the default theme (without adding any new identifiers, but still) in version 1.1.3. By looking at the forums I realized that if you upgrade to 1.1.6 the default theme has a new version of the “boxes.css” which will make things messy if I go ahead and upgrade.
I think the right thing to do is to use indeed the custom.css. The design guide for magento suggests that actually:
c. Adding custom stylesheets and js libraries (part I)
Any external stylesheet files (css) or javasript/ajax libraries (js) that we want to include in our new project must be also
copied to proper folders.
Stylesheets
Copy the files to /skin/frontend/new_template/default/css folder
Don’t forget to include new file in styles.css file. We can do this by adding a
@import url(’your_new.css’);
after
@import url(’custom.css’);
Did you perform this action? I think that looking at page.xml is the wrong place to search for this import. Styles.css is the right place to add any imports.
why should adding a style sheet be this difficult lol. I mean its not difficult, but yet it is for a stylesheet
It’s not difficult at all. Go to my website and click on the book cover to go to the product page. You will find a link there under “Excerpts” for adding custom CSS files to your pages.
I appended
<action method="addCss"><stylesheet>css/new_style.css</stylesheet></action>
after
<action method="addCss"><stylesheet>css/clears.css</stylesheet></action>
But then I banged my head against the wall for a few hours trying to get relative image paths to work for css background images. After reading this post I went and read very carefully the provided links… And found relative paths work just fine if you insert this:
into the top of the (styles.css for blank theme) or (boxes.css for default theme) file. No other linking to the new custom css file was necessary. Great work leading me to that solution. The only other gum in the works was I had a “my_css” folder inside the css folder and had to remove it to get the relative links to work.
Thanks to everyone who is adding to the community! Solution tested in 1.3.2.2.
(styles.css for blank theme) or (boxes.css for default theme) is in the folder located at: skin>frontend>default>your_theme>css. You put that code in the top of the file after the comments as shown in the snippit. Hope this helps.
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @licensehttp://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */