Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

HTML Syntax

Elements

Element are the basic building block of HTML code. Below is the general syntax of an element:


<element_name>element content</element_name>
    

In programming lingo, the stuff inside the angle brackets is called a tag. Elements consist of a starting tag, a closing tag, content, and attributes (which we'll learn about later).

Notice how the tag at the front (the starting tag) is different from the tag at the end (closing tag). This is very important. We'll talk about why they're different when we get to nesting elements.

You can also have tags with no content inside:


<tag_name>
    

Attributes

Attributes are things that we can add to elements to change their properties. Attributes follow the following form:


<element_name attribute_name="attribute_value">content</element_name>
    

Notice how the attributes go inside the starting tag. They do not go in the ending tag.

We can also have multiple attributes:


<element_name attribute1_name="attribute1_value" attribute2_name="attribute2_value">content</element_name>