Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a self-closing HTML5 tag like <br> [closed]

Tags:

html

tags

I want to basically make a custom tag that doesn't need to be closed and apply css to it.

It shouldn't look like this:<customtag></customtag>.

It should look like this: <customtag> or <customtag/>.

like image 591
BVSK Avatar asked Feb 13 '23 02:02

BVSK


1 Answers

Unless an element is already defined to be a void element in the HTML spec, they must have a closing tag.

Because of this, all custom web components must have a close tag. Additionally, custom elements must have a hyphen in their names to avoid conflicting with possible future tags.

like image 88
zzzzBov Avatar answered Feb 16 '23 02:02

zzzzBov