我注意到,IE9,Firefox和Chrome都允許你使用任意的html標籤並使用CSS來標記這些標籤。所有現代瀏覽器都支持自定義/任意HTML標籤。有沒有理由不使用它們?
下面是一個示例HTML文件,我刮起來測試這一點,這工作在所有現代瀏覽器:
<html>
<head>
<title>Test</title>
<style>
h3 { font-family: Arial; }
animals { padding: 20px; display: block; background-color: #eee; }
dog { background-color: brown; color: white; display: block; padding: 10px; }
</style>
</head>
<body>
<animals>
<dog>
<h3>Dog</h3>
</dog>
<cat>
<h3>Cat</h3>
</cat>
<giraffe>
<h3>Giraffe</h3>
</giraffe>
</animals>
</body>
</html>
向後兼容性不談,如果自定義標籤是由現代瀏覽器的支持,爲什麼不該」我是否將它們(與現有的官方標籤規範結合使用)使我的標記在語義上與內容,應用程序元素等相關?
[自定義標籤...爲什麼不可以重複?](http://stackoverflow.com/questions/8906448/custom-tags-why-not) –
[HTML5:爲什麼不使用我自己的任意標籤名稱?](http://stackoverflow.com/questions/16867332/html5-why-not-use-my-own-arbitrary-tag-names) – Flimzy