自定义html标签

自定义html标签 (觉得页面全是div 的解决办法 来个个性化)

办法一(来源于 让ie支持html5标签的方法):

 

在ie9以前如果要自定义要使用document.createElement的方法

自定义一个helloworld的标签把 

直接上代码

复制代码
 1 <!DOCTYPE html>
 2 <html lang="zh-cn">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 5     <title></title>
 6     <!--[if lt IE 9]>
 7     <script type="text/javascript">
 8           document.createElement('helloworld');
 9     </script>
10     < ![endif]-->
11     <script type="text/javascript">
12         document.createElement('helloworld')
13     </script>
14     <style type="text/css">
15        helloworld { color: red; }
16     </style>
17 </head>
18 <body>
19     <helloworld>
20        754756765
21     </helloworld>
22 </body> 

23 </html> 

复制代码
所以在js加了ie9的判断

 

 

办法二: (来源于:HTML自定义标签-采用xml标记)

 

  直接上图

   

 ps:我发现只在ie9+以上有效 而且html里面的 xmlns 属性也是多余的 ,不知道我哪里写错啦 

 

请各位看官评论

 

 

 

 

 

分类: wp8
标签: HtmlCss

原文地址:https://www.cnblogs.com/Leo_wl/p/3255298.html