In this lesson, you'll learn what the minimal required
code is to create a basic web document. Note that the
minimal HTML is not just about creating a web page: it's
also about creating a valid, well-formed page,
which is something we'll look at in a later lesson.
Prerequisites
It's important that you understand basic
HTML Syntax before doing this lesson.
Minimal HTML Document Structure
In order to remain valid, an HTML document must
contain a certain set of elements. These elements are called the
minimal HTML. All documents must contain the
minimal HTML or they are not valid,
well-formed documents (more
on what valid/well-formed means later).
If your document is missing any of the elements or attributes
shown above, it is considered invalid and/or mal-formed.
Summary of Minimal Elements
To learn more about each of the tags used here, read the following
from W3Schools and MDN. W3Schools is a great site for basic
tutorials, and MDN (Mozilla Developers' Network) contains the
"official" documentation for elements and attributes:
The lang="en" attribute inside the HTML element
indicates that the document's primary
language is in English. This tells screen readers what kind of
pronounciation to use when reading the document.
The lang attribute can be used in other elements, and helps screen readers
know what accent to apply to the content of the element. You can read
more at MDN: lang attribute
<head>
The <head> element contains data about the document.
The contents of the document head are not visible to the user
in the browser viewport (the area inside the browser window that
display's the page contents).
<title> defines the document's title. This appears in the bookmark
list when the page is bookmarked, in the browser window or browser
tab when the page is being viewed in the browser, and a few other
places.
Don't confuse the <title> element with the title
attribute, which is covered in a later lesson.
<meta>
The META element defines data about the document data. For example, it can be used
to define the author of the document, a summary description
of the document, and many other things.
The META element's name attribute defines the name of the piece of data
you're defining e.g. name="author" to indicate that you're going
to define the author of the document.
The META element's content attribute defines the value of the
data item defined with the name attribute.
Other elements can be added to the minimal HTML as appropriate,
but this is the minimal code that you are required to have in
your document for it to be considered valid.