Why This Self-closing Title Tag Breaks My Web Page
hello
Solution 1:
If you have a void element:
<img /><br />
Then they have no content, because there's nowhere to put it. Images can be thought of as an empty <div>
with a background image.
Compared to these elements:
<h1>Hello</h1>
<section>World</section>
Which actually contain stuff (in this case, text).
The reason that the <title/>
breaks your page is because you need a title in a webpage - if you don't have one, it'll just display the URL of the page, for example:
google.com/index.html
You need to have a valid title, and <title>
is not a void element. This is why it breaks. To see this, go to a HTML validation website (e.g. https://validator.w3.org) and see what it tells you.
In short - <title>
is not a void element - it requires an opening and closing tag.
EDIT: Research showed me this website, which says:
Self-closing:No
So in short they're not self-closing elements. You can find a list of self-closing elements here.
Post a Comment for "Why This Self-closing Title Tag Breaks My Web Page"