1

How do I add custom CSS or JS to for a particular page?

Suppose,i want add a custom css file for Checkout cart which will only show n at Cart.

Example: like a FAQ or any single page

Amit Bera
77.8k21 gold badges127 silver badges240 bronze badges
asked Jun 23, 2015 at 21:44

3 Answers 3

3

if you want to add a css file to all cms pages add this to your local.xml

<layout>
 <cms_page_view>
 <reference name="head">
 <action method="addItem">
 <type>skin_css</type>
 <name>path/to/file.css</name>
 </action>
 </reference>
 </cms_page_view>
</layout>

If you want a css file just for the FAQ page, go to that CMS page and go to Design tab in the left menu and insert:

<reference name="head">
 <action method="addItem">
 <type>skin_css</type><name>path/to/file.css</name>
 </action>
</reference>
answered Jun 23, 2015 at 23:28
1

You should add some CSS/JS files only in local.xml file in your magento theme.

app/design/frontend/PACKAGE/TEMPLATE/layout/local.xml

<layout>
 <default>
 <reference name="head">
 <action method="addJs">
 <script>path/to/file.js</script>
 </action>
 <action method="addItem">
 <type>skin_css</type>
 <name>path/to/file.css</name>
 </action>
 </reference>
 </default>
</layout>

https://blog.liip.ch/archive/2013/10/24/adding-javascript-and-css-files-to-head-section-of-magento.html

answered Jun 23, 2015 at 22:16
0

You can find the related phtml pages, here in your file directory

/app/design/frontend/default/YOURTHEME/template/page

depending on your theme, you might see files named

1column.phtml
2columns-left.phtml
2columns-right.phtml
3columns.phtml

You can find the header section in those files, where you can link your CSS files or js

answered Jun 23, 2015 at 22:01
1
  • Editing the .phtml files is not the correct way of adding a stylesheet. Commented Jun 24, 2015 at 0:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.