Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTariq wazir
3,369 Points(html)- why all of the codes must be between tag?
(html)- why all of the codes must be between tag?
1 Answer
Jamie Reardon
Treehouse Project ReviewerYou are coding in the html language, so when creating html tags, you will want your code between them because you are essentially telling the computer hey I am inputting html, read it like that. It will understand you are outputing html. The browser will therefore understand the html code and can output it to the screen correctly. Computers arent mind readers, but they are smart when you tell them what to do by sending computer instructions.
Any code that is not in-between the tags may cause errors or be outputted by the computer the way you didn't intend it to be.
Some (to my knowledge) coding languages have their code wrapped between identical tag identifiers for example:
PHP
<?php
// Php code here...
?>
Other coding languages don't have opening and closing name conventional tags, they are just saved and recognized by the computer with their file extension name instead.