Is there any problem with using HTML5's “data-*” attributes for older browsers?

前端 未结 2 1623
灰色年华
灰色年华 2020-11-30 09:36

I want to associate some custom data with some HTML nodes. I was going to use the new HTML5 style \'data-*\' attributes. e.g.:

2条回答
  •  佛祖请我去吃肉
    2020-11-30 10:14

    There isn't really, they're not 100% correct/valid usage in HTML4 of course....but they don't cause problems either, so they're still a great way to solve the "I need an attribute for this" problem.

    If it helps, I've used these while supporting IE6 and have had zero issues thus far, and I can't recall a single SO question reporting any either.

提交回复
热议问题