CSE 322
Fall 2018
CSUSB

The HyperText Markup Language

If one wishes to learn how to make a website from scratch as fast as possible, HTML is the first and primary language to learn; all other web languages being of secondary importance.

As mentioned earlier, HTML is used for describing the content and structure of a webpage (a webpage is a document that is meant to be displayed in a web browser). Since a website is a collection of web pages that are linked together, one can create an entire web site using HTML alone.

The alphabet of HTML syntax belongs to plain text, thus a user can produce HTML code by using a text editor and a web page can be produced by saving HTML code from that text editor to the file system. After which, that web page can be opened and displayed by a web browser. This process can repeat for every significant edit to a web page or web site as it undergoes development.

The following HTML code describes a web page titled "My webpage" and containing a single paragraph that says "Hello world!".

<!DOCTYPE html>
<html>
    <head>
        <title>My Webpage</title>
    </head>
    <body>
        <p>Hello world!</p>    
    </body>
</html>

An HTML document is represented by a hierarchy of elements, at the root of this hierarchy is the html element. Within the html element are exactly two elements: the head element and the body element, in that order. No other elements should be directly under the html element (an element that is directly enclosed by another element is known as a nested element). The head element contains metadata for the document, such as the document's title, author, and directives for layout and styling. The body element contains the content of the document which is to be presented to the user.

Each element is syntactically represented by it's start tag, it's content, and it's end tag. For example, the element <p>Hello world!</p> has <p> for it's start tag, Hello world! for it's content, and </p> for it's end tag. The name used within an element's start tag and end tag must be the same, this name is simply known as the tag of that element. The start tag and end tag are also sometimes referred to by others as the opening tag and closing tag respectively.

All text that begins with <html> and ends with </html> is the HTML document. The line <!DOCTYPE html> is not part of the document, it is only stored at the beginning of the same file that stores the document to indicate to web browsers that the file stores an HTML document. It is always required.