Is it OK to use unknown HTML tags?

前端 未结 12 1217
梦如初夏
梦如初夏 2020-11-30 04:54

Correct me if I\'m mistaken, but AFAIK, unknown HTML tags in markup (i.e. tags not defined in the HTML spec, like say, ) will eventually be treate

12条回答
  •  独厮守ぢ
    2020-11-30 05:21

    Rule #1 of browser interoperability is: don't have errors. No matter how many browsers you test in, there are always browsers you can't test, for instance because they don't exist yet.
    Also, unknown elements will be treated as , not

    by most browsers currently.

    If it's really source readability(*) you're after, you should look into XML+XSLT.
    That way, you can use all the tag names you want, and make them behave in any way you like and you don't have to worry that will be a real element in some future version of HTML.

    One good real world example is the element . If a website ever used and relied on the notion that this element would have no styles or special content by itself, they are in trouble now!

    (*) With XML+XSLT, the readability will be in the XML part, not the XSLT part, obviously.

提交回复
热议问题