Key HTML Tags
There are over 100 different HTML tags.
However, you don't need to memorize the purpose of every tag perfectly. It is sufficient to be familiar with the commonly used tags listed below.
-
<div>
: Defines divisions or sections in a web page layout, used to group block elements for styling. -
<p>
: Represents a paragraph, used to define text-based sections. -
<input>
: Used for input fields, allowing user data entry. -
<img>
: Displays images, specifies the path to the image file using thesrc
attribute. -
<a>
: Defines a hyperlink to another webpage or section. -
<ul>
: Defines an unordered list of items. -
<li>
: Defines a list item within an<ul>
tag.
Tags that are used without an ending tag (</tag>
) are referred to as self-closing tags
.
For example, img
and input
are self-closing tags without child content, and are written with a slash (/
) at the end, like <img />
and <input />
.
<input type="text" placeholder="name" />
Note: The
type
attribute in the input self-closing tag specifies the type of user input, and theplaceholder
attribute provides a hint text within the input field. Offering additional details within HTML tags is referred to as usingattributes
.
The code above is an example of a text input field for the user's name. You can see that the slash is written at the end of the opening tag, like />
.
Practice
Follow the emphasized parts of the code with asterisks and try inputting them.