[英]Is there any pure html way to “combine” markup tags into custom one?
I am wondering if I can make something like: 我想知道是否可以做类似的事情:
<myTag>myAwesomText</myTag>
While "myTag" is a combination of other html tags, example: 而“ myTag”是其他html标签的组合,例如:
<div class="myClass">
<p>myAwesomText</p>
</div>
Simply the answer is no, this is not possible in HTML. 只是答案是否定的,这在HTML中是不可能的。
Usually your text editor (for example Sublime Text) has an option to create snippets where you can customise a shortcut like <myTag>
in which custom HTML or any code can be inserted. 通常,您的文本编辑器(例如Sublime Text)具有创建片段的选项,您可以在其中自定义诸如<myTag>
类的快捷方式,可以在其中插入自定义HTML或任何代码。 If you are interested in this, see Sublime Text and Their Snippet Feature 如果对此感兴趣,请参见Sublime Text 及其摘录功能
Note: you could also use a functional language like Javascript to create a feature like this 注意:您也可以使用Java等功能语言来创建类似的功能
Also, a hacky way of doing something similar to this is creating a custom html element and using css to modify its properties ( although I'm sure this isn't widely supported ): 另外,一种类似的方法是创建一个自定义html元素并使用css修改其属性( 尽管我确定这不受广泛支持 ) 是一种骇人听闻的方法:
mytag { font-weight: bold; color:red; }
<mytag>This is bold and red</mytag>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.