Introduction to HTML - Detailed Notes
Overview
HTML (HyperText Markup Language) is the standard markup language used to create and design
web pages. HTML structures the content on the web by using elements represented by tags. It is
not a programming language; it's a markup language that tells the browser how to display content.
History and Evolution
HTML was created by Tim Berners-Lee in 1991. Over the years it has evolved from simple static
markup to a modern standard (HTML5) that supports multimedia, graphics, and APIs for rich web
applications.
Basic Structure of an HTML Document
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<h1>Main Heading</h1>
<p>Sample paragraph text.</p>
</body>
</html>
Explanation of the parts:
• <!DOCTYPE html> - Declares the document type and HTML version (HTML5).
• <html> - Root element that contains the whole HTML document.
• <head> - Metadata container: title, character set, links to CSS, scripts, and meta tags.
• <body> - The visible content of the page: headings, paragraphs, images, links, forms etc.
HTML Elements and DOM
An HTML element is made up of a start tag, content, and an end tag. The browser parses the HTML
and constructs a Document Object Model (DOM): a tree-like representation of the document that
can be manipulated by JavaScript.
Semantic HTML
Semantic tags (like <header>, <nav>, <article>, <section>, <footer>) give meaning to page
structure. Using semantic HTML improves accessibility and SEO.
Common semantic elements and purpose:
• <header> - Introductory content or navigation for a page or section.
• <nav> - Navigation links.
• <main> - Main content unique to the page.
• <article> - Independent, self-contained content.
• <section> - Thematic grouping of content.
• <footer> - Footer content such as authorship, related links, or copyright.
Accessibility and Best Practices
Accessibility is crucial for inclusive web design. Use alt attributes for images, proper heading order
(h1-h6), labels for form fields, and ARIA roles when necessary.
Best practices summary:
• Keep structure semantic and logical.
• Use external CSS for styling; keep HTML for structure.
• Minimize inline styles and deprecated tags.
• Validate HTML to catch errors and improve cross-browser compatibility.