HTML
HTML, or HyperText Markup Language, is the standard markup language used to create web pages. It’s a combination of Hypertext, which defines the link between web pages, and Markup language, which is used to define the text document within tags to structure web pages. This language is used to annotate text so that machines can understand and manipulate it accordingly. HTML is human-readable and uses tags to define what manipulation has to be done on the text. This guide will help you understand the workings of HTML and explain it with examples.
Table of Contents
ToggleOverview:
- Hypertext: Refers to the way in which webpages are linked to one another through hyperlinks. This allows users to navigate between different pages on the web.
- Markup Language: A language that uses tags to annotate the content within a document. In HTML, these tags define the structure and presentation of text, images, and other media on a webpage.
Basic Structure of an HTML Document:
Page Title
This is a Heading
This is a paragraph.
This is a link
Key Components:
Tags and Elements:
- Tags: Enclosed in angle brackets, e.g.,
<h1>
,<p>
,<a>
. Most tags have an opening and a closing tag, like<p>
and</p>
. - Elements: The combination of a tag, its content, and the closing tag. For example,
<h1>This is a Heading</h1>
is an element.
- Tags: Enclosed in angle brackets, e.g.,
Attributes:
- Tags can have attributes that provide additional information. Attributes are written inside the opening tag, such as
href
in an anchor tag (<a>
). - Example:
<img src="image.jpg" alt="Description of image">
- Tags can have attributes that provide additional information. Attributes are written inside the opening tag, such as
Head Section (
<head>
):- Contains metadata, such as the title of the page (
<title>
), links to CSS files, and other information not directly displayed on the page.
- Contains metadata, such as the title of the page (
Body Section (
<body>
):- Contains the content that will be visible to the user, including text, images, videos, links, and more.
What Is HTML?
HTML stands for Hyper text Markup Language and it is used to create website. It uses HTML tags and attributes to describe the structure and formatting of a web page.
HTML consists of various elements, that are responsible for telling search engines how to display page content. For example, headings, lists, images, links, and more.
HTML consists of a series of elements, represented by tags (<>), which wrap around content to define its purpose. These elements can include:
1. Headings (h1-h6)
2. Paragraphs (p)
3. Links (a)
4. Images (img)
5. Lists (ul, ol, li)
6. Forms (form, input, textarea)
7. Tables (table, tr, td)
8. Divisions (div)
9. Spans (span)
HTML documents typically include:
1. A doctype declaration (!DOCTYPE html)
2. A head section (head) containing metadata
3. A body section (body) containing the visible content
Key Components of HTML:
- Tags: HTML uses tags to structure content. Tags are enclosed in angle brackets, such as
<tagname>
. Most tags come in pairs, with an opening tag (e.g.,<p>
) and a closing tag (e.g.,</p>
). - Elements: An HTML element consists of the opening tag, the content, and the closing tag. For example:
This is a paragraph.
In this example, <p>
is the tag, and the entire structure forms a paragraph element.
3.Attributes: Tags can have attributes that provide additional information about an element. Attributes are included within the opening tag and are usually written in name-value pairs. For example:
Here, href
is an attribute that specifies the link destination.
4. Document Structure: A basic HTML document has a standard structure, including the <!DOCTYPE html>
declaration, <html>
, <head>
, and <body>
elements. For example:
Page Title
My First Heading
My first paragraph.
<!DOCTYPE html>
declares the document type.<html>
is the root element.<head>
contains meta-information like the title and links to stylesheets.<body>
contains the content of the webpage that is visible to users.