Introduction to HTML

HTML (HyperText Markup Language) is the standard language used to create web pages. It provides the structure and elements needed to display content on a webpage.

Basic Structure of an HTML Document

An HTML document is made up of essential components:

    <!DOCTYPE html>
    <html>
        <head>
            <title>My First Webpage</title>
        </head>
        <body>
            <h1>Welcome to My Website</h1>
            <p>This is a paragraph of text in HTML.</p>
        </body>
    </html>
    

Explanation of Elements

DOCTYPE html declares the document type and version.

html is the root element that wraps all content.

head contains metadata such as title, links to CSS, and scripts.

title defines the title shown in the browser tab.

body holds visible webpage content.

Common HTML Tags

Headings

HTML has six heading levels:

    <h1>Main Heading</h1>
    <h2>Subheading</h2>
    <h3>Smaller Subheading</h3>
    

h1 is the largest, while h6 is the smallest.

Paragraphs

Text is placed inside p tags.

    <p>This is a paragraph of text.</p>
    

Links

Hyperlinks are created using a tags:

    <a href="https://example.com">Click Here</a>
    

Images

Images are embedded using img tags:

    <img src="image.jpg" alt="Description">
    

Lists

Unordered List (Bullets):

    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
    </ul>
    

Ordered List (Numbers):

    <ol>
        <li>First item</li>
        <li>Second item</li>
    </ol>
    

Tables

Tables organize data into rows and columns:

    <table>
        <tr>
            <th>Name</th>
            <th>Age</th>
        </tr>
        <tr>
            <td>Alice</td>
            <td>25</td>
        </tr>
    </table>
    

Forms & User Input

Forms allow users to enter data:

    <form action="submit.php" method="post">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name">
        <input type="submit" value="Submit">
    </form>
    

Adding CSS for Styling

You can style your webpage using CSS (Cascading Style Sheets).

    <style>
        body {
            background-color: lightblue;
            font-family: Arial, sans-serif;
        }
    </style>
    

Conclusion

HTML is the foundation of web development, allowing you to create structured, accessible, and interactive web pages. Once you master HTML basics, you can combine it with CSS and JavaScript to build modern websites.