Comments and Doctype1:48 with Joy Kesten
Step-by-step instructions to write comments and why the DOCTYPE is important to include.
Now that you're familiar with HTML and 0:00 CSS as languages let's break down exactly what you were doing. 0:02 Looking at the code you may have noticed some grayed out text at 0:07 the top of the page. 0:11 This is called a comment. 0:12 When you run the code this line doesn't show up anywhere in the browser. 0:14 In the HTML code, comments are created by using a less than sign, 0:19 an exclamation point and then two dashes. 0:24 You close a comment by putting two dashes and then a greater than sign. 0:27 Comments are used to put thought or 0:32 explanation into your code for you and others to understand what's going on. 0:34 Below that you'll see the doc type, or document type. 0:39 The doc type tells the browser what kind of document it is, and 0:42 in our case it's plain HTML. 0:46 Including the doc type in the document ensures that the browser makes 0:49 the best effort to follow the list of instructions you've created. 0:53 While you were coding you might have noticed that this attribute is 0:57 not necessary to run you code. 1:00 However, it's good practice and should be the first thing on an HTML document. 1:02 Next you will notice an opening HTML tag. 1:07 This is a good time to introduce you to the idea of tags. 1:11 HTML uses tags, which you can think about as instructions that have 1:15 angle brackets around them, such as comments or paragraphs. 1:19 When writing tags into your code, be sure the opening tag has two angle brackets and 1:24 the closing tag has a slash after the first angle bracket. 1:29 Now that you've learned how to set up your HTML page and use comments to help you and 1:33 other coders know what's going on inside your code, 1:39 let's take a quick code challenge on starting an HTML document and 1:42 a short quiz to make sure you're following along. 1:45
You need to sign up for Treehouse in order to download course files.Sign up