Lecture

Key HTML Tags

HTML has over 100 different tags.

However, there's no need to memorize the use of every single tag. Instead, focus on these commonly used tags:

  • <div>: Structures the layout (Division, frame) of a webpage and groups child elements

  • <p>: Represents a paragraph, defining a block of text

  • <input>: Allows users to enter data, such as text or numbers

  • <img>: Displays an image by specifying the file path with the src attribute

  • <a>: Creates a hyperlink that directs users to another webpage or a specific section within a page

  • <ul>: Defines an unordered list

  • <li>: Represents an individual item within a <ul> tag


Tags that are used without a closing tag (</tag>) are called self-closing tags.

For example, the img and input tags are self-closing tags that do not have any content, written as <img /> and <input /> with a slash (/) at the end of the tag.

Example of a self-closing input tag
<input type="text" placeholder="name" />

Note: The type attribute within the input self-closing tag specifies the type of user input, while placeholder displays hint text in the input field. Providing additional information within HTML tags is called using attributes.


The code above is an example of a text input field to receive the user's name, and you can see that it ends with />.


Practice

Follow the highlighted parts of the code and try typing them yourself.

Mission
0 / 1

What is the most appropriate tag for the blank below?

The tag used to receive user input data is .
<div>
<p>
<input>
<img>

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

HTML
CSS
Loading...