Some basic HTML elements

This page will show you some examples of basic HTML elements, including

Lists

In the section above you can see an example of an HTML unordered list. To view the HTML source that set up the list you can view the source code for this page.

HTML lists come in two basic flavors, the unordered list (<ul>) and the ordered (or numbered) list (<ol>).

The individual entries in a list are stored in <li>...</li> elements.

Tables

In the section on Entities below you can see an example of an HTML table.

To make a table we start with a <table>...</table> element.

Inside the table we make rows with the <row>...</row> element.

Inside rows we make cells with either the table head (<th>...</th>) or table data <td>...</td> elements.

Images

The <img> element set up an image. This element typically requires the use of two attributes, the src attribute and the alt attribute. The src attribute contains the link to the image file for the image, and the alt attribute contains the so-called alt text that will be displayed if the page is unable to load the image.

Below you will see an example of an image. If you view the page source for this page you will see that the image is also embedded in a figure element with an associated caption.

A picture of Joe Gregg
Our Fearless Leader

Links

The HTML <a>...</a>, or anchor, element is used to set up a link in a document.

The href attribute in the a element specifies the URL that the link goes to, while the text in the body of element is the text that will be displayed for the link.

Here are a couple of examples:

Link to the CMSC 406 home page

Link to the top of this page

Entities

Entities are used to insert special characters in HTML text. Entities have two primary uses: allowing us to put characters that have special meanings in HTML into ordinary text, and allowing us to display characters that are not part of the standard ASCII character set.

Some characters are used for special purposes in HTML. For example, the < character is used by HTML to mark the beginning of a tag. If you want to display one of these special characters in ordinary text you will have to use an entity to get the character to show up properly.

The table below shows several of these entities:

Entity CodeCharacter It Produces
&lt;<
&gt;>
&amp;&
&quot;"

You can also use entities to render special symbols, such as π (&pi;) and ∞ (&infin;).