
Hi there! It sounds like you're encountering a common situation when HTML behaves in unexpected ways.
In HTML, every opening tag should ideally have a closing tag to ensure that browsers render the content correctly, just like this:
This is a heading
This is a paragraph.
However, when you omit a closing tag like you've done here:
This is a heading
This is a paragraph.
browsers step in and try to "fix" the structure automatically. They'll assume where the ending tags should be, but this isn't always reliable and can result in unexpected outcomes, especially as your projects become more complex.
This automatic behavior might work similarly in your text editor like Visual Studio Code, but it’s not best practice. Therefore, always include closing tags to maintain clear and consistent HTML structure:
This is a heading
This is a paragraph.
Remember, it'll help prevent your webpage from displaying incorrectly or "breaking" unexpected parts of your layout.
Hope this helps clear things up! If any more questions come up as you go further, feel free to ask. I'm here to help!
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer