开发者

Making Custom HTML Tags

开发者 https://www.devze.com 2023-04-05 06:01 出处:网络
I understand that you can make your own HTML tags, but how do I go about doing it? Can you make it once and then just use it over and over again in the same file without redefining it? Can you import

I understand that you can make your own HTML tags, but how do I go about doing it?

Can you make it once and then just use it over and over again in the same file without redefining it? Can you import it into other files?

I also wa开发者_运维百科nt to know if it is recommended to make custom HTML tags. Does it work in all browsers?

I know this is a lot, so I will thank you in advance.


Why would you want to do that in the first place? Generally, people stick with existing tags and if they need to make them unique, they do it through ids, classes or attributes. However, with introduction of HTML5, which introduced a number of new tags, this problem surfaced, since IE was not supporting them. The solution for supporting HTML5 tags in IE was using HTML5 shiv. Basically, in the head you do something like that:

document.createElement("article");  
document.createElement("footer");  
document.createElement("header");  
document.createElement("hgroup");  
document.createElement("nav"); 

Perhaps you can do something like that? Still not sure why you'd want to do that though.

0

精彩评论

暂无评论...
验证码 换一张
取 消