Friday, July 26, 2024

Basic Structure of an HTML Document


The basic structure of an HTML document includes several key elements.
  • It begins with the <!DOCTYPE html> declaration to specify the HTML version.
  • The <html> tag wraps the entire content of the document.
  • Within the <html> tag, the <head> section contains meta-information such as the title, character set, and links to stylesheets.
  • The <title> tag, placed within the <head>, defines the document's title.
  • Finally, the <body> section holds all the content displayed on the webpage, including text, images, and links.

HTML Code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Tutorial</title>
</head>
<body>
    <h1>Basic Structure of an HTML Document</h1>
    <p>An HTML document has a basic structure that includes the doctype declaration, head, and body sections.</p>
    <pre>
        <!DOCTYPE html>
        <html>
        <head>
            <title>Page Title</title>
        </head>
        <body>
            <h1>This is a Heading</h1>
            <p>This is a paragraph.</p>
        </body>
        </html>
    </pre>
</body>
</html>


The Output of the above code:


HTML Tutorial - Page 2

Basic Structure of an HTML Document

An HTML document has a basic structure that includes the doctype declaration, head, and body sections.

        
        
        
            Page Title
        
        
            

This is a Heading

This is a paragraph.