通过指定html命名空间的名字来定义自定义标签;默认的一些标签p div等都在html默认的命名空间下。而自定义的标签可以放在自定义的命名空间下,可通过xmlns:命名空间名 来指定,而自定义标签需要带命名空间名,而在设置样式的时候使用 命名空间名\:标签名
<!doctype html public -//w3c//dtd xhtml 1.0 transitional//en
http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
<html xmlns:ownhtml>
<head>
<meta charset="utf-8">
<title>document</title>
<style>
ownhtml\:customdiv{
font-size: .36rem;
font-weight: bold;
color:red;
}
p{
color: green;
}
</style>
</head>
<body>
<!--
通过指定html命名空间的名字来定义自定义标签;默认的一些标签p div等都在html默认的命名空间下。而自定义的标签可以放在自定义的命名空间下,可通过xmlns:命名空间名 来指定,而自定义标签需要带命名空间名,而在设置样式的时候使用 " 命名空间名\:标签名 "
-->
<ownhtml:customdiv class="custom">this is a custom element!</ownhtml:customdiv>
<p>this is normal text</p>
</body>
</html>