Home > Article > Web Front-end > How to customize tags in html
This article mainly introduces how to customize HTML tags. Friends who are interested can refer to it. I hope it will be helpful to everyone.
The code is as follows:
<!DOCTYPE html> <!-- 通过指定html命名空间的名字来定义自定义标签; 默认的一些标签p p等都在html默认的命名空间下。 --> <!-- 第一步:自定义的标签可以放在自定义的命名空间下,可通过xmlns:命名空间名 来指定 --> <html xmlns:mine> <head> <meta charset="UTF-8"> <title>自定义标签</title> <style> /* 第三步: 自定义标签在设置样式的时候使用 " 命名空间名\:标签名 " */ mine\:tag { font-size: .36rem; font-weight: bold; color: red; } p { font-size: 25px; color: chocolate; } </style> </head> <body> <p>this is normal text</p> <!-- 第二步: 自定义标签需要带命名空间名 " 命名空间名:标签名 " --> <mine:tag>this is custom text</mine:tag> </body> </html>
Related recommendations:
How Vue operates html field strings and converts them into HTML tags
How to convert the html fields in the data into HTML tags
Convert the string with html tags into HTML tags
The above is the detailed content of How to customize tags in html. For more information, please follow other related articles on the PHP Chinese website!