2February2015/ 0000770 0001751 0001001 00000000000 12464172261 011451 5 ustar Roy None 2February2015/index.html 0000770 0001751 0001001 00000007623 12464170505 013460 0 ustar Roy None
For visual consistency, use tabs or spaces in your source code; don’t mix them. Regardless of your choice, set the tab’s or space’s width in your text editor to be equivalent to 2, 3, or 4 spaces. All the HTML source code I share with you is space-separated in threes.
A tab and a space each takes up 1 byte, and both are whitespace characters. However, unlike a space, a tab’s width is malleable: it can be set to the width of one or more spaces, depending on your text editor. This is useful for keeping your documents small.
The <!DOCTYPE html>
item, known as the doctype declaration, sets the HTML5 grammatical stage for your source code. It defines which elements can be used in a document and whether they can appear as descendants or siblings of other elements. (It also defines allowable attributes within tags.) The doctype must appear as the first item in your document; it is not HTML and is the only non-HTML item allowed in an HTML document.
<html>
ElementThe <html>
element, AKA the root element, is the root of the Document Object Model, or DOM, tree. As such, it must appear immediately after the doctype.
The root element may only have two descendants, <head>
and <body>
, and <head>
must appear before <body>
.
<head>
ElementThe <head>
element allows for <meta>
, <link>
, and <script>
elements, among others, in order to setup your document. Once the <head>
is processed by the browser, the document can be considered “ready” for rendering.
<title>
ElementThe <title>
element is the only element in the <head>
to render content to the screen, and does so in places that the <body>
element does not. For example, tabs in browsers render content extracted from the <title>
element; minimized windows in Linux, Mac, and Windows generate info bubbles whose content is drawn from the <title>
element; and, when bookmarking a page in a browser, the name of the bookmark is the content of the <title>
element.
The <title>
element plays a major role in Search Engine Optimization, or SEO. So that the title of a document fits within the search results page in a browser, ensure that the title of your document does not exceed 65 characters. (See the title of this document.)
Make sure that your documents end in only one newline character, the empty lines do not contain any whitespace characters, and that the last character on a line is a printing character.