Previous lesson

Chapter 1 - HTML Elements

Next lesson

Before we continue, let me talk to you a little bit more about HTML elements. HTML stands for HyperText Markup Language, and it is used to create web pages by defining the different elements that make up the page like we saw in the previous chapter. HTML uses "tags" to mark up different elements of a page, such as headings, paragraphs, images, links, and more. In this section, we will introduce the basics of HTML elements and how they are used to structure web pages.

HTML elements are like different types of building blocks that we can use to create different things. For example, we have an element called "heading," which we use to create titles at the top of our website. If we were using Microsoft Word, we would just highlight the heading and icreased its size using one button. We do this in HTML by enclosing the portion of text to be formatted with tags.

HTML elements or tags are the building blocks of web pages, and they define the structure of the content on a page. Each element is represented by a tag, which is enclosed in angle brackets < and >. HTML elements usually come in pairs - an opening tag and a closing tag - with the content to be displayed inside the tags.

The closing tag is the same as the opening tag, but with a forward slash before the tag name.

For example, the <h1> element is used for the main heading on a page and is enclosed by opening <h1> and closing </h1> tags. To create an <h1> element, you would use the following code:

<h1>This is the main heading</h1>

In this code, the opening tag is <h1>, and the closing tag is </h1>. The text "This is the main heading" is the content that will be displayed as the main heading of the page.

HTML elements can also have attributes, which provide additional information about the element. Attributes are added to the opening tag of an element and are used to modify the behavior or appearance of the element. For example, the <img> element is used to display images on a page, and it has an "src" attribute that specifies the URL of the image file to display and the "alt" attribute provides a text description of the image for users who cannot see the image. The code for adding an image to a page would look like this:

<img src="image.jpg" alt="This is an image">