HTML tags and elements
Hello, students! In this lesson, we will learn about the basic elements of HTML5.
HTML elements are building blocks used to create web pages.
Each HTML element consists of an opening tag, content, and a closing tag.
Opening Tag
The opening tag indicates the start of the element.
The opening tag is always followed by the element’s name, written in uppercase letters.
For example, the opening tag for a level 1 heading is as follows:
<h1>
Content
The content is the text or material that will be displayed in the browser.
Content can be anything, such as text, images, videos, etc.
For example, the following code creates a level 1 heading with the text “My first title”:
<h1>My first title</h1>
Closing Tag
The closing tag indicates the end of the element.
The closing tag is always followed by the element’s name, written in lowercase letters.
For example, the closing tag for a level 1 heading is as follows:
</h1>
Types of HTML Elements
HTML elements are divided into three main types:
- Text Elements: Used to display text on the web page. Examples of text elements include
<h1>
,<p>
,<strong>
,<em>
,<code>
, and<pre>
. - Structure Elements: Used to organize the content of the web page. Examples of structure elements include
<div>
,<ul>
,<ol>
,<dl>
,<table>
, and<form>
. - Presentation Elements: Used to control the appearance of the web page content. Examples of presentation elements include
<img>
,<a>
, and<style>
.
Exercises
- Create an HTML document with a level 1 heading, a paragraph, and an image.
- Save the document and open it in a browser.
Observe how the browser displays the title, paragraph, and image.
Good luck!
In the next module, we will learn more about text elements, including how to use CSS styles to format the text.
Text elements are the basic building blocks of any web page.
Understanding how to use them correctly is essential for creating effective web pages.