1

I am working to validate W3C errors in the magento shop.It is including the css in theme's page.xml by using the code:

<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>

When check at W3C validator it give error:

Element link is missing required attribute property

I did search for this error and found a sloution here that i can use property='stylesheet' to fix the error.

Now the question is how to use property='stylesheet' here with magento css include code?

3
  • IMHO, W3C validation was cool 10 years ago when everybody had those shiny badges on their site, but any more it is just a waste of time and effort for little to no real gain. This is especially true with CMS and e-commerce platforms that dynamically generate HTML. It does help, however, in finding areas that could be improved upon. Commented Mar 26, 2016 at 14:00
  • @JosephLeedy I strongly disagree with you, W3C validation is an important point, especially in terms of performance. I reckon it's worth doing it if you can Commented Mar 26, 2016 at 18:16
  • any solution to fix this? Commented Mar 28, 2016 at 5:23

1 Answer 1

0

You need to just put element between action method like this <property>property='stylesheet'</property>

For example :-

<action method="addCss"><stylesheet>css/styles.css</stylesheet><property>property='stylesheet'</property></action>

Or if you want to add it in all css links then just copy Head.php from here :

app\code\core\Mage\Page\Block\Html

And paste it here :

app\code\local\Mage\Page\Block\Html

And find the below mentioned line public function getCssJsHtml() in this method

$html .= $this->_prepareStaticAndSkinElements('<link rel="stylesheet" type="text/css" href="%s"%s />'."\n",

Now you can add your property here like :

 $html .= $this->_prepareStaticAndSkinElements('<link rel="stylesheet" type="text/css" property="stylesheet" href="%s"%s />'."\n",

Hope it will work for you.

1
  • applied the fix and clear cache, worked fine.thanks Commented Mar 28, 2016 at 6:12

Your Answer

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.