HTML, or HyperText Markup Language, is the standard language used to create and design web pages. It structures the content on the web and allows browsers to display text, images, links, and other elements. Here’s a brief introduction to its key components:
Basic Structure of an HTML Document
An HTML document is structured using elements defined by tags. Here’s a simple template:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Web Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is my first paragraph in HTML.</p>
<a href="https://www.example.com">Visit Example.com</a>
</body>
</html>
Key Components
- Doctype Declaration:
<!DOCTYPE html>tells the browser that this document is an HTML5 document. - HTML Tag:
<html>is the root element that wraps all the content. - Head Section: Contains metadata (data about data) such as the title of the document, character set, and links to stylesheets or scripts.
- Body Section: Contains the content that will be displayed on the web page, including text, images, links, and other media.
Common HTML Tags
- Headings:
<h1>to<h6>for creating headings, where<h1>is the largest. - Paragraph:
<p>for text paragraphs. - Links:
<a href="URL">for hyperlinks. - Images:
<img src="image.jpg" alt="description">to embed images. - Lists:
<ul>for unordered lists and<ol>for ordered lists.
Attributes
Tags can have attributes that provide additional information. For example, in <a href="https://www.example.com">, href is an attribute that specifies the link’s destination.