All of your HTML documents should begin with the following standardized set of elements in the header:
A document’s doctype determines which “rendering mode” will be used to display the document. The first line of your HTML document should be the HTML5 doctype declaration:
Using the HTML5 doctype does not mean that you must also use HTML5 elements within your document. This doctype is “backwards-compatible” with older HTML and XHTML syntax.
Directly after the doctype declaration, include the opening
html tag with the
lang attribute set to the language of the document, along with the
<html lang="en"> <head>
meta element specifiying the character encoding should be added
directly after the opening
The character encoding
meta element is inserted early in the
the HTML5 specification
explains that the
meta tag should appear in the first 1024 bytes of the document.
Although the character encoding
meta element should be included
regardless, the character encoding should also be specified via server-side
Content-Type: text/html; charset=utf-8
Also be sure your text editor is set to UTF-8.
UTF-8 is the only recommended character encoding for web pages.
Next, add the
<title>Document Title - Site Name</title>
The title should be short and descriptive. Put the most salient part of the title first. For example, use “Faculty : Department of Gaucho Studies” rather than “Department of Gaucho Studies : Faculty,” so that the most distinguishing part of the title (“Faculty”) will be visible to the user.
meta element is often used by search engines to describe
<meta name="description" content="The UCSB News Page features the latest news and press releases from the University of California, Santa Barbara.">
Next, include your CSS stylesheets:
<link href="css/main.css" rel="stylesheet">
<noscript> <link href="css/noscript.css" rel="stylesheet"> </noscript>
The following example summarizes the above suggestions:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Document Title - Site Name</title> <meta name="description" content="Description of document"> <link href="css/main.css" rel="stylesheet"> <noscript> <link href="css/noscript.css" rel="stylesheet"> </noscript> </head> <body>