Export Image

Fork of Fork of HTML Starter

Md Mozammel Hoque

0 views in last 90 days
Last edited Feb 01, 2026
Created on Feb 01, 2026

HTML Elements Explanation

This document explains all the HTML elements used in the index.html file.

Document Structure Elements

<!DOCTYPE html>

  • Purpose: Declares that this is an HTML5 document
  • Type: Document type declaration (not technically an HTML element)
  • Required: Yes, should be the first line of every HTML file
  • Effect: Tells the browser to render the page in standards mode

<html>

  • Purpose: The root element that wraps all content in the HTML document
  • Type: Container element
  • Required: Yes
  • Contains: <head> and <body> elements

Head Section Elements

<head>

  • Purpose: Contains metadata and resources for the document
  • Type: Container element
  • Visible: No, content is not displayed on the page
  • Contains: Document information like title, stylesheets, scripts, and meta tags

<title>

  • Purpose: Defines the title of the webpage
  • Type: Text element
  • Content: "HTML Starter"
  • Displayed: In the browser tab/window title bar
  • Required: Yes, every HTML document should have a title

<link>

  • Purpose: Links external resources to the HTML document
  • Type: Self-closing/void element (no closing tag needed)
  • Attributes Used:
    • rel="stylesheet": Specifies the relationship (stylesheet in this case)
    • href="styles.css": Path to the CSS file
  • Effect: Loads and applies the CSS styles from styles.css

Body Section Elements

<body>

  • Purpose: Contains all visible content of the webpage
  • Type: Container element
  • Visible: Yes, everything inside is rendered on the page
  • Contains: All displayable content (text, images, divs, etc.)

<div>

  • Purpose: A generic container for grouping content
  • Type: Block-level container element
  • Attributes Used:
    • class="message": Assigns a CSS class for styling
  • Content: "Hello HTML!" (text)
  • Effect: Creates a division/section in the document

<script>

  • Purpose: Embeds or references JavaScript code
  • Type: Container element (can contain code or reference external files)
  • Attributes Used:
    • type="module": Treats the JavaScript as an ES6 module
    • src="index.js": Path to the external JavaScript file
  • Placement: At the end of <body> ensures HTML loads before JavaScript executes

Element Hierarchy

MIT Licensed