问题
I am new to magento and i want to add one css file 'responsive.css' in the page.xml
. But this file i want to add last of all css files including the extension's css files.
<block type="page/html_head" name="head" as="head">
<!-- other css & js files -->
<action method="addCss"><stylesheet>css/responsive.css</stylesheet></action>
</block>
And if i view the page source, my responsive.css file is showing before the extensions css files. So please help me how i can include at last of all css files.
回答1:
You can remove and add your responsive.css again in your page.xml. Be sure to do that after all other css files have been added:
<?xml version="1.0"?>
<layout>
<default>
<reference name="head">
<!-- ... add your other css files ... -->
<action method="removeItem"><type>responsive_css</type><name>css/responsive.css</name></action>
<action method="addItem"><type>responsive_css</type><name>css/responsive.css</name></action>
</reference>
</default>
</layout>
回答2:
I did a quick google search and found the magento stack exchange website and a brilliant answer there that seems like it would work for you: https://magento.stackexchange.com/questions/12150/overwriting-a-css-style
- One way to combat this is, instead of using page.xml, to put the declaration in local.xml of your theme's layout folder. This will be loaded last and therefore your css overrides will come last.
- Another way to handle this is to create a custom layout file and reference it from a local module's config.xml
- Edit the original css file at the bottom to override its styles
See the post above for more information on this list of fixes. Basically you're looking for ways to insert your css code after the code you want to override so you can avoid using !important declarations.
回答3:
try
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
来源:https://stackoverflow.com/questions/27752533/adding-css-file-after-all-extensions-css-files