1

I want to use a tag to insert text repeatedly so I won't need to re-type:

Currently I am using this CSS:

<style>  

 more:before {
           content: "... Hello this is some text ...";
           font-style: italic;
           color: #7A7777;
        }
</style>

I am using this as:

<more>

and result is:

... Hello this is some text ...

Is this an okay usage? Do I need <more></more>? Just <more> seems to work for what I wanted to do but I wanted to confirm if this won't cause any problems.

1

3 Answers 3

2

Only some tags are self closed like <br> and <hr>, <ímg>, which means that there is just a slash at the end of the opening tag.

Conclusion: You have to use the closing tag <more></more>!

The entire list of self closing tags:

area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr

http://xahlee.info/js/html5_non-closing_tag.html

3
  • Can I create a self-closing tag? Any case example where <more> can go wrong?
    – user963241
    Commented Jan 30, 2022 at 19:13
  • @user963241 I'm relatively sure it won't work. Custom elements require a closing tag. Commented Jan 30, 2022 at 19:16
  • @user963241 Good question! Commented Jan 30, 2022 at 19:16
0

pseudo element supposed to remain as used here with :before element. but if there's no closing tag. it will affect the next tag if position is changed somehow.

0

<more> will fail HTML5 validation.

You can create your own custom tags but there are certain rules, including they must have a closing tag and they must have a - within the name (to distinguish them from any tags names that are already or may be put into the standard).

Read about custom components and the various restrictions for example at https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements

Not the answer you're looking for? Browse other questions tagged or ask your own question.