HTML自定义标签

今天浏览了一个网站
http://www.qjqw.com/zongci/paiwei.asp?z_id=81
里面有个红线 是用自定义html完成的
<html   xmlns:v="urn:schemas-microsoft-com:vml">   
<head>
<style   type="text/css">   
v\:*{ BEHAVIOR: url(#default#VML)}   
o\:*{ BEHAVIOR: url(#default#VML)}   
.shape{BEHAVIOR:url(#default#VML)}
</style>   
</head>   
<body>   
<v:line   StrokeColor='red'   StrokeWeight='2'   from='400,100'   to='120,150'   style='POSITION:absolute;'></v:line>
</body></html>
http://hi.baidu.com/1076739/blog/item/20d44e36f8c3ffd8a2cc2b2b.html
具体步骤
1.声明标签
在<html>标签中进行这样的申明:<html xmlns:huangyu>,xmlns即xml name space的缩写。是HTML标记的命名空间属性:一般其声明在元素开始标记的地方。只要在这里申明了我要使用的<huangyu/>这一自定义标签,语法分析器就会认识这个标签并赋予我定义的属性了。
2.定义自定义标签样式属性
<style type="text/css"> 
suntear\:my{border:1px solid #ccc;background-color:#efefef;font-weight:bold;} 
suntear\:your{border:1px solid red;background-color: #FFF5F4;font-weight:bold;} 
</style>
3.使用自定义标签
<huangyu:sorry>对不起,</huangyu:sorry> 
<huangyu:love>我爱你!</huangyu:love>
4.完整的代码
<!-- 自定义HTML Tag -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns:huangyu> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>自定义HTML标签</title> 
<style type="text/css"> 
huangyu\:sorry{border:1px solid #ccc;background-color:#efefef;font-weight:bold;} 
huangyu\:love{border:1px solid red;background-color: #FFF5F4;font-weight:bold;} 
</style> 
</head> 
<body> 
<huangyu:sorry>对不起,</huangyu:sorry> 
<huangyu:love>我爱你!</huangyu:love> 
</body 
</html>
原文地址:https://www.cnblogs.com/xyzhuzhou/p/2616223.html