Is it alright to add custom Html attributes?

前端 未结 11 800
醉梦人生
醉梦人生 2020-12-14 02:23

I have a site I\'m working on where I want to mark if a row of data has been changed. If something has been changed in that row I would mark it with a custom attribute like

11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 02:44

    HTML 5 supports custom attributes prefixed with "data-". So, I would use that to be forward-compatible.

    As for earlier versions, I don't think it will validate, but I wouldn't worry about that. I've heard that some browsers may ignore these tags, though. So, be sure to test it all around.

提交回复
热议问题