Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minimal HTML 5 Document. This is NOT the smallest valid HTML 5 document, but rather a minimal but readable, maintainable, and accessible document with which to start.
<!-- Note that HTML is an XML-based language, so some syntax seen here is in the name of sticking with XML standards. -->
<!-- The DOCTYPE element in XML is provided to help explain the following document. Since HTML is well-defined already,
browsers use the DOCTYPE to determine what version of HTML they should be targeting when parsing and rendering it.
The following is the defined DOCTYPE element for HTML 5. -->
<!DOCTYPE html>
<!-- Every XML document needs a root element. In HTML, that root element is the aptly named "html" element. The "lang"
attribute is used for accessibility purposes by the browser; "en" stands for English. -->
<html lang="en">
<!-- The "head" element contains most meta information, but other sorts of HTML that are intended to be processed
before the rest of the document may be placed here. Most notably "script," "style," and "link" elements are
usually placed here. -->
<!-- This particular "meta" element tells the browser what character set to use when interpreting the characters
and entities. UTF-8 is a popular character set and is considered the standard by many. -->
<meta charset="utf-8"/>
<!-- The "title" element (besides obviously defining the title of the document) is typically used by browsers
to label tabs or windows. Depending on your browser and operating system, the title may show up in other
places on your screen. A valid HTML 5 document must have a non-empty "title" element. -->
<title>Minimal HTML 5 Document</title>
<!-- The "body" element contains all of the HTML meant as content. Most of your HTML will likely go in the "body"
element. When creating full JavaScript applications, it is common to see non-renderable content placed in
the "body" element due to the way HTML documents are processed. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.