[英]Is it possible to create custom HTML elements that act like standard ones
How do i go about creating a custom HTML element that acts like a link with out using inline Javascript我如何去创建一个自定义的 HTML 元素,它就像一个链接而不使用内联 Javascript
For example:例如:
<x-button href="...">...<x-button>
Is it possible to create an element like <x-button>
that will take an attribute such as href
the same way an a
element would?是否可以创建一个像<x-button>
这样的元素,它会像a
元素一样采用href
等属性?
The HTML element don't support every attribute. HTML 元素并不支持每个属性。 If you want a button acting like a link, you can use directly the <a href="#"></a>
element and add some css on it too look like a button.如果你想要一个像链接一样的按钮,你可以直接使用<a href="#"></a>
元素并在它上面添加一些 css 看起来像一个按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.