Google +1按钮不符合W3C标准 [英] Google +1 Button not W3C compliant

查看:137
本文介绍了Google +1按钮不符合W3C标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在玩Google的+1按钮试图在我的网站上获取它,但它不符合W3C。

So I've been playing with Google's +1 button trying to get it on my website, but it's not W3C compliant.

这是代码:

<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="http://apis.google.com/js/plusone.js">
  {lang: 'en-GB'}
</script>

<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="medium" href="http://www.example.org"></g:plusone>

有谁知道为什么会发生这种情况以及如何使其合规?谢谢

Does anyone know why this happens and how to make this compliant? Thanks

编辑:为了让这个通过验证,我在网站

To get this to pass through the validation, I wrote an article on my website.

推荐答案


有谁知道为什么会这样?

Does anyone know why this happens?

因为Google设计的是使用标签汤而不是HTML

Because Google designed it to use tag soup instead of HTML


如何使其符合要求?

How to make this compliant?

文档具有替代标记,该标记在草案HTML 5规范:

The documentation has alternative markup that is valid under the draft HTML 5 specification:

<div class="g-plusone" data-size="standard" data-count="true"></div>

如果您希望它与HTML 4.x或XHTML 1.x一起使用,那么您可能会出局幸运的是(虽然你可能能够使用JS添加不兼容的标记,但这只是一个黑客从验证隐藏它而根本没有有效标记的精神)

If you want it to work with HTML 4.x or XHTML 1.x then you might be out of luck (although you might be able to add the non-compliant markup using JS, but that would just be a hack to conceal it from validation and not at all in the spirit of valid markup)

这篇关于Google +1按钮不符合W3C标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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