2

So I basically got my own whole css layout and I want to change the layout of my magento frontend. I've looked into this post: https://stackoverflow.com/questions/17050668/how-to-apply-css-to-magento-cms-page but it's not loading my css in. I did this:

I added to Custom Layout Update XML:

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

and in my html editor I got this:

<div class="header">&nbsp;</div>
<div class="header_2">&nbsp;</div>

Css just in case:

.header{
width:80%;
margin-left:10%;
height:15%;

/*border-radius:12px; */
background-color:white;
}

.header_2{
width:80%;
margin-left:10%;
height:5%;
background-color:grey;
font-size:200%;
}   

My style.css is in this directory:/skin/frontend/default/csstest I also tried to put it in: skin/frontend/default/default/css

Am I forgetting something?

  • afaik it's <name> not <stylesheet>. – user3154108 Oct 10 '14 at 9:33
  • have you not, by mistake, set a custom directory for CSS in System > Configuration > General > Design? – Julien Lachal Oct 10 '14 at 12:33
1

Better use this syntax:

<reference name="head">
    <action method="addItem">
        <type>skin_css</type>
        <name>csstest/style.css</name>
    </action>
</reference>
  • It's still not showing my divs... – Loko Oct 10 '14 at 9:45
  • Are you missing the divs or the CSS styles for the divs? – Kai Köpke Oct 10 '14 at 9:54
  • I editted my question. I posted the code of my css and html editor. – Loko Oct 10 '14 at 9:55
  • Check in your browser if the CSS file is loading (check the link to the CSS file too), if the html code for the divs is appearing, empty Magento Cache, Browser Cache and so on... – Kai Köpke Oct 10 '14 at 9:57
  • When I press CTRL + U, it doesn't show link rel="stylesheet" style.css. The css file isn't in it. The html code is showing yes. I tried emptying the caches and it didn't do anything. – Loko Oct 10 '14 at 11:22
0

Just curious, why are you not using a local xml and local css combo. Also, have you updated your configuration to pull from the right design package and themes?

Its in System > General > Design >

Package should be where the files is loaded from initially. Normally set to default theme package. And theme is if you have created a new theme folder. This needs to match exactly where you are loading you templates / skins / layouts and all lower case.

Lastly, I think your syntax is slightly wrong for the xml file. Here is some more info about local xml and syntax.

https://stackoverflow.com/questions/25156808/magento-custom-css-overridden-by-parent-css-using-local-xml

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