HTML Basics - Introduction to HTML

What is HTML?

HTML stands for HyperText Markup Language. It is the standard language used to create and design web pages. HTML structures the content on the web and consists of elements like headings, paragraphs, links, and images.

Basic HTML Document Structure

An HTML document has a standard structure that includes the following elements:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Page Title</title>
    </head>
    <body>
        <h1>Welcome to HTML!</h1>
        <p>This is a basic HTML document.</p>
    </body>
</html>

This code defines the basic structure of an HTML document. It includes the `` declaration, which specifies the document type and version, and the `html`, `head`, and `body` elements.

Common HTML Elements

HTML is made up of elements that are represented by tags. Tags are enclosed in angle brackets. Here are some common HTML elements:

For example, to create a paragraph and a link, you would use:

<p>This is a paragraph.</p>
<a href="https://www.example.com">Visit Example</a>

HTML Attributes

Attributes provide additional information about HTML elements. They are always specified in the opening tag and consist of a name and a value. For example:

<a href="https://www.example.com" target="_blank">Visit Example</a>

In this example, `href` is an attribute of the `` tag that specifies the URL, and `target="_blank"` is an attribute that opens the link in a new tab.