是< link> (不是rel =" stylesheet")是否允许在< body>中使用? [英] Is <link> (not rel="stylesheet") allowed to be used in <body>?

查看:133
本文介绍了是< link> (不是rel =" stylesheet")是否允许在< body>中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google,Yahoo和MS推出的新 schema.org 建议使用<

 < div itemscope itemtype 属性显示产品在网上商店的状态:

= http://schema.org/Offer >
< span itemprop =name> Blend-O-Matic< / span>
< span itemprop =价格> $ 19.95< / span>
< link itemprop =availabilityhref =http://schema.org/InStock/>今天可用!
< / div>

然而, < link> ,只允许在头部分中使用asp:rel =noreferrer>


注意:此元素仅在head部分中出现,但它可以出现任意次。


我不习惯W3C风格,所以我无法理解确切的 W3C定义。任何人都可以帮助我:真正允许在正文中使用< link> (在HTML5中,因为schema.org使用HTML5标签)或者Google,Yahoo和MS打破标准?

解决方案

WHATWG HTML规范提到, LINK -element可以有一个 rel -attribute:

 < link rel =.../> 

itemprop -attribute

 < link itemprop =.../> 

但不是两者。



rel -version仅限于 HEAD -element,而 itemprop -version可能出现在 HEAD BODY -elements中。



http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-link-element



WHATWG规范是什么:

whatwg.org/specs/web-apps/current-work/multipage/introduction.html#is-this-html5?


The new schema.org by Google, Yahoo and MS recommends usage of the <link> attribute to display the status of products in an online shop:

<div itemscope itemtype="http://schema.org/Offer">
  <span itemprop="name">Blend-O-Matic</span>
  <span itemprop="price">$19.95</span>
  <link itemprop="availability" href="http://schema.org/InStock"/>Available today!
</div>

Yet, according to w3schools.org <link> is only allowed in head sections:

Note: This element goes only in the head section, but it can appear any number of times.

I am not used to W3C style, so I was not able to understand the exact definition by W3C. Can anybody help me: Is it really allowed to use <link> within the body (in HTML5, as schema.org uses HTML5 tags) or do Google, Yahoo and MS break the standard?

解决方案

The WHATWG HTML specification mentions, that the LINK-element can either have a rel-attribute:

<link rel="…" />

or an itemprop-attribute

<link itemprop="…" />

but not both.

The rel-version is restricted to the HEAD-element, whereas the itemprop-version may appear in both, the HEAD and BODY-elements.

http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-link-element

What is this WHATWG specification:

whatwg.org/specs/web-apps/current-work/multipage/introduction.html#is-this-html5?

这篇关于是&lt; link&gt; (不是rel =&quot; stylesheet&quot;)是否允许在&lt; body&gt;中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆