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.
CodePudding user response:
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
CodePudding user response:
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.
CodePudding user response:
<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
