定义一个html中不解析的模板,有如下三种方法
1、使用<xmp>标签

<xmp id="test">
  <div>测试</div>
</xmp>

2、使用<template>标签

<template id="test">
  <div>测试</div>
</template>

3、使用javascript

<script id="test" type="text/template">
    <div>测试</div>
</script>

 总结:<xmp>这个标签已经废弃,新版本中建议使用<pre><code>但是实际上后两个没有<xmp>效果好。javascript兼容性好一些。

相关文章:

  • 2021-11-12
  • 2021-05-04
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
猜你喜欢
  • 2021-06-25
  • 2022-12-23
  • 2021-07-14
  • 2021-09-27
  • 2021-11-12
  • 2021-09-27
相关资源
相似解决方案