我正在检查w3c验证器上的代码,我不断得到这些错误的每个个人博客和投资组合的帖子,有"喜欢"按钮附加到它。我能做些什么来纠正这些错误,使它们正确验证吗?
下面是一个示例代码:
<a href="#" class="like " title="Like this" data_action="likepost" data_postid="74" data_nonce="13e20f93ee">
<span class="glyphicon glyphicon-heart"></span>
<span class="likecount">2</span>
</a>
确保你有这样的doctype声明:
<!DOCTYPE html>
并将自定义属性替换为:
data-action data-postid and so on.
注意hyphen
而不是underscore
。HTML5允许自定义属性,建议使用以data-
开头的属性。
A custom data attribute is an attribute in no namespace whose name starts with the string data-, has at least one character after the hyphen, is XML-compatible, and contains no uppercase ASCII letters
参考