Basic HTML Syntax and Structure

Beginner

๐Ÿงฑ Basic Structure of an HTML Document

An HTML document begins with a declaration and follows a structured format using tags and elements.


๐Ÿ—๏ธ Document Layout

1. <!DOCTYPE html>

Declares the HTML5 document type.

2. <html>

The root element that wraps the entire page content.

Contains metadata like:

  • ๐Ÿท๏ธ Page title (<title>)
  • ๐Ÿงต Links to stylesheets
  • ๐Ÿ’ก Scripts and other resources

4. <body>

Holds the visible content such as:

  • ๐Ÿ“ข Headings
  • ๐Ÿ“„ Paragraphs
  • ๐Ÿ”— Links
  • ๐Ÿงฉ Interactive elements

๐Ÿท๏ธ Tags, Elements & Attributes

  • Elements consist of an opening <tag> and a closing </tag>.
  • Attributes (like id, class, href) provide additional information about elements.

โœ… Proper nesting and indentation improve readability and maintainability.


๐Ÿ’ก Example: Basic HTML Structure

<!DOCTYPE html>
<html>
<head>
    <title>Sample Page</title>
</head>
<body>
    <h1>Welcome to HTML Tutorial</h1>
    <p>This is a paragraph explaining HTML basics.</p>
</body>
</html>