What is HTML?
=============
.. index:: ! hypertext, ! markup language, ! HTML
The web is a collection of documents, which are stored in servers. Many of
these documents are written in a language called **HTML**, which stands for
*Hypertext Markup Language*.
The term **hypertext** refers to text that includes links (also called
*hyperlinks*) to other text.
HTML documents are made up of:
#. *Text* - The words we see on a page.
#. *Links* to other pages.
#. **Markup** - Determines what the text looks like and how that text and other
content is arranged on the page.
#. *References* to other documents - Videos, images, code editors, etc.
HTML code does not execute logic or perform calculations like Python. There are
no ``for`` loops, ``if/else`` statements, or functions. Instead, HTML is an
example of a **markup language**. Markup languages provide instructions for
what text should look like on the screen. They format the text of a document
(like the size of a section heading) and define the structure of the page (like
the number of sections or placement of images).
HTML uses two main components, *elements* and *tags*, to define the structure
of a web page.
HTML Elements
-------------
With HTML, a programmer can add a lot of different types of content to a page.
In this chapter, we focus on headings, paragraphs, images, and more.
When a programmer creates a web page, they break the content down by type:
#. What text needs to be on the page, and how will it be organized?
#. Are there any images/figures/videos?
#. How many links?
#. Will there be a form to fill out?
#. Will there be a menu or a navigation bar?
#. etc.
The next step for many developers is to sketch the layout for the page on paper
or in a drawing app. They highlight what each item is, where it belongs on the
page, and ideas about what it might look like.
.. index:: ! element
An **element** is one portion of an HTML page. By combining and arranging
different elements, a developer builds the structure for the page.
Elements are often broken down by content type---text, links, images, titles,
etc. Elements can also be *nested* inside other elements. This makes it easy,
for example, to align a figure caption with the image it describes.
.. figure:: figures/html-elements.png
:alt: Arranging elements determines the layout of a web page.
The seven elements on the left are arranged to create the layout for the HTML page.
HTML tags
---------
.. index:: ! tag
An HTML **tag** tells the computer the type and content of an HTML element.
Most elements include a *start tag* and an *end tag*, with content in between.
Every tag has the following structure:
#. Begin with the ``<`` symbol and end with the ``>`` symbol.
#. The tag name goes inside the ``<>``, and it indicates the element type.
#. Start tags and end tags share the same structure. However, end tags (also
called *closing tags*) include the ``/`` symbol after the ``<`` bracket.
#. Start tags may include extra content that affects the element's appearance.
The general syntax for an HTML element is:
::