Core HTML Tags Overview

HTML Document Structure

1. Document Structure (<!DOCTYPE html>, <html>, <head>, <body>)

This is the basic structure of an HTML document, including the document type declaration and the main tags used to organize the content.

HTML Example:


<!DOCTYPE html>
<html lang="en">
<head>
    <!-- The <meta> tag defines metadata about the HTML document, such as character encoding, author, and viewport settings. -->
    <meta charset="UTF-8">
    <meta name="description" content="A brief description of the webpage content.">
    <meta name="keywords" content="HTML, CSS, JavaScript">
    <meta name="author" content="Your Name">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- The <title> tag defines the title of the webpage, which appears on the browser tab. -->
    <title>My Webpage</title>

    <!-- The <link> tag is used to link external resources like CSS files to the HTML document. -->
    <link rel="stylesheet" href="styles.css">

    <!-- The <style> tag contains internal CSS, which allows you to add styles directly within the HTML document. -->
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            margin: 0;
            padding: 0;
        }
        h1 {
            color: #333;
        }
    </style>

    <!-- The <script> tag is used to include JavaScript code or link to external JavaScript files. -->
    <script>
        function displayMessage() {
            alert("Welcome to my webpage!");
        }
    </script>
</head>
<body onload="displayMessage()">
    <!-- The <body> tag contains all the content of the webpage, such as text, images, and links. -->
    <h1>Hello, World!</h1>
    <p>This is a simple webpage example.</p>
</body>
</html>

Explanation:

Rendered Example:

Hello, World!

This is a simple webpage example.

Previous Next
Modern Footer