html元素可以具有多个属性,关于html5:HTML元素可以具有任意属性吗?

本问题已经有最佳答案,请猛点这里访问。

Possible Duplicate:

Custom attributes - Yea or nay?

可以为HTML元素分配任意属性吗?

例如:

是的,您可以具有自定义属性。

但是您的HTML不会被验证。

为避免此问题,只需在属性的前面加上data-即可验证您的HTML ...

下一个答案让我对这个示例有些担心,因为根据该规范,该规范禁止使用大写字母

@Sushanth-"您的HTML不会被验证"是什么意思?

是的,但是它们必须以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 characters in the range

U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z).

W3C HTML5规范:http://dev.w3.org/html5/spec/single-page.html?utm_source = dlvr.it&utm_medium = feed#embedding-custom-non-visible-data-with-the-data-*- 属性

是。

John Resig发表的HTML5自定义数据属性

http://ejohn.org/blog/html-5-data-attributes/

HTML4属性

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值