HTML
π WEEK 1: Foundations & Text Formatting
Lesson 1: Web Fundamentals & HTML Boilerplate
1. Core Concepts
- Client-Server Architecture: When you open a browser (Client) and enter a URL, it requests files from a remote machine (Server). The server sends back HTML, CSS, and JavaScript files for your browser to render.
- What is HTML? HyperText Markup Language defines the structure and meaning of content on a web page using elements enclosed in tags (
<tagname>).
2. The Standard Document Template
Every HTML5 document requires a standard outer structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first paragraph on the web.</p>
</body>
</html>Key Tag Explanations:
<!DOCTYPE html>: Informs the browser that this document uses HTML5 standards.<html>: The root container element enclosing all page content.<head>: Holds metadata, character encoding, CSS links, and document titles that aren't displayed directly inside the page body.<meta charset="UTF-8">: Specifies universal UTF-8 text encoding (covers symbols, emojis, and international characters).<body>: Encloses all visible content (text, images, forms, videos).
π οΈ Hands-on Task (Class 1)
- Open your text editor (VS Code, CodePen, or Replit).
- Create a file named
index.html. - Type out the HTML5 template above, set the page title to βCS Student β Lab 1β, and view it in your browser.
Lesson 2: Headings, Text Formatting & Comments
1. Heading Hierarchy (<h1> β <h6>)
Headings structure page content logically for accessibility screen readers and search engines:
<h1>Main Topic (Page Title - Use Once)</h1>
<h2>Major Subsection</h2>
<h3>Sub-topic Details</h3>2. Inline Text Elements
<strong>: Marks text as high importance (bold rendering).<em>: Adds emphasis (italic rendering).<mark>: Highlights text visually.<code>: Formats inline programming snippets in monospace font.<p>: Defines a block-level paragraph.<br>: Forces a line break within text (self-closing tag).
3. Writing Code Comments
Comments are invisible in the browser viewport and are used for documentation:
<!-- This is a single-line comment -->π οΈ Hands-on Task (Class 2)
Create a page named article.html and format a brief tech news entry using:
- One
<h1>title and two<h2>section headings. - At least two paragraphs containing
<strong>,<em>, and<mark>tags. - A hidden code comment above the main article body.
The Core Anatomy of an HTML5 Document
Before placing content on a page, you need to set up the global document wrapper. Every HTML5 document follows a standardized root architecture that provides metadata to the browser, configures character encoding, and ensures accurate viewport scaling across mobile and desktop devices.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 1. Character Encoding -->
<meta charset="UTF-8">
<!-- 2. Responsive Viewport Configuration -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 3. Document Title -->
<title>Academic Portal | Dashboard</title>
</head>
<body>
<!-- All user-visible markup resides here -->
</body>
</html>Critical Metadata Breakdown
<!DOCTYPE html>: The standard preamble that instructs the browser rendering engine to parse the document using the modern HTML5 standard in "standards mode" (preventing "quirks mode").<html lang="en">: Defines the document's primary language. Essential for screen readers to select correct pronunciation rules and for search engine localization.<meta charset="UTF-8">: Sets character encoding to UTF-8, covering virtually all human written languages and special symbols.<meta name="viewport" content="width=device-width, initial-scale=1.0">: Sets the page rendering width to match the physical device width (width=device-width) and sets the initial zoom scale to $1.0$. Without this, mobile browsers default to simulating a desktop layout (typically $980\text{px}$ wide) and scale the text down, breaking responsive designs.
2. Semantic Landmark Elements vs. Non-Semantic Containers
Prior to HTML5, developers built web layouts using generic divisions (<div id="header">, <div class="nav">, <div id="sidebar">). While visually functional when styled with CSS, generic <div> elements convey zero meaning to search engine crawlers, screen readers, and other assistive technologies.
Get Ade Codeβs stories inΒ yourΒ inbox
Join Medium for free to get updates fromΒ thisΒ writer.
HTML5 introduced dedicated Semantic Landmark Elements that explicitly communicate the role of each page section.
When to Use <div> and <span>
<div>(Block-level container): Use strictly for styling, visual wrappers, grid layouts, or positioning hooks where no inherent semantic meaning exists.<span>(Inline-level container): Use for applying targeted CSS styles, scripts, or micro-markup to a specific fragment of text inside a paragraph or heading.
3. Structural Content Grouping: Section vs. Article
A common point of confusion in university-level Web Development is choosing between <article> and <section>.
<!-- Example A: Sections inside an Article -->
<main>
<article>
<h1>The Science of Quantum Computing</h1>
<section aria-labelledby="heading-intro">
<h2 id="heading-intro">Introduction to Qubits</h2>
<p>Unlike classical bits...</p>
</section>
<section aria-labelledby="heading-entanglement">
<h2 id="heading-entanglement">Quantum Entanglement</h2>
<p>When particles become correlated...</p>
</section>
</article>
</main>
<!-- Example B: Articles inside a Section -->
<main>
<section aria-labelledby="latest-news">
<h2 id="latest-news">Department News</h2>
<article>
<h3>New Physics Lab Opening</h3>
<p>The university has inaugurated...</p>
</article>
<article>
<h3>Research Grant Awarded</h3>
<p>Dr. Smith received funding for...</p>
</article>
</section>
</main>Decision Matrix
- Ask yourself: βIf I syndicate or publish this snippet on another website or RSS feed completely isolated from the rest of this page, does it make complete sense on its own?β
- Yes $\rightarrow$ Use
<article>. - No $\rightarrow$ If it is simply a chapter, sub-topic, or thematic grouping of a larger piece, use
<section>.
4. Document Heading Hierarchy ($h1 \rightarrow h6$)
Headings construct an invisible outline of your page. Screen readers rely heavily on headings to let visually impaired users jump directly to relevant content blocks.
<!-- CORRECT: Logical Heading Structure -->
<h1>Computer Science Department</h1> <!-- 1 Primary Page Title -->
<h2>Undergraduate Programs</h2> <!-- Sub-topic Level 1 -->
<h3>B.S. in Computer Science</h3> <!-- Sub-topic Level 2 -->
<h3>B.S. in Software Eng</h3> <!-- Sub-topic Level 2 -->
<h2>Graduate Programs</h2> <!-- Sub-topic Level 1 -->
<h3>Ph.D. in AI</h3> <!-- Sub-topic Level 2 -->
<!-- INCORRECT: Broken Hierarchy -->
<h1>Computer Science Department</h1>
<h3>Undergraduate Programs</h3> <!-- BAD: Skipped h2 -->
<h5>B.S. in Computer Science</h5> <!-- BAD: Skipped h4 -->Heading Rules
- Never skip levels going down. Do not transition directly from an
<h1>to an<h3>. - One
<h1>per page (Recommended). While the HTML5 specification technically permits multiple<h1>elements if nested inside separate sectioning elements, web accessibility standards (WCAG) and SEO best practices strongly advocate for a single, authoritative<h1>defining the primary topic of the page. - Do NOT choose heading tags for text size. Use CSS for font sizes, weights, and styling. Use HTML heading tags exclusively to define document relationships and structural depth.
5. Web Accessibility Standards (WCAG) & ARIA Landmarks
Creating a accessible web layout involves ensuring that users navigating with keyboards or screen readers can parse and move through your page as effectively as a sighted mouse user.
A. Skip Links (Keyboard Navigation)
Keyboard-only users press the Tab key to move through focusable elements (links, buttons, inputs). On pages with large navigation bars, forcing a user to press Tab 20 times before reaching the main content creates unnecessary friction. A Skip Link solves this problem.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Skip Link Implementation</title>
<style>
/* Visually hide the skip link until it receives keyboard focus */
.skip-link {
position: absolute;
top: -100px;
left: 10px;
background: #000000;
color: #ffffff;
padding: 10px;
z-index: 9999;
}
.skip-link:focus {
top: 10px; /* Moves into view on focus */
}
</style>
</head>
<body>
<!-- Must be the first focusable element inside <body> -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<header>
<nav>
<!-- Complex site navigation links here -->
</nav>
</header>
<!-- Target of the skip link; tabindex="-1" allows JS/CSS focus shifting -->
<main id="main-content" tabindex="-1">
<h1>Main Dashboard Content</h1>
<p>Target content starts here.</p>
</main>
</body>
</html>B. ARIA Landmarks and Accessible Naming
When multiple landmark elements of the same type exist on a single page (e.g., a main navigation and a footer navigation), assistive technologies require explicit labels to distinguish them.
<!-- Differentiating Navigation Landmarks -->
<header>
<nav aria-label="Global Site Navigation">
<ul>...</ul>
</nav>
</header>
<main>
...
</main>
<footer>
<nav aria-label="Legal & Policy Links">
<ul>...</ul>
</nav>
</footer>
<!-- Differentiating Sections via Heading Associations -->
<section aria-labelledby="department-announcements">
<h2 id="department-announcements">Announcements</h2>
<p>Content goes here...</p>
</section>6. Comprehensive Practical Example
Below is a complete HTML5 template integrating semantic landmarks, accessible headings, keyboard navigation, and ARIA attributes without using any generic <div> layout wrappers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>University Student Portal</title>
<style>
.skip-link {
position: absolute;
top: -40px;
left: 0;
background: #00274c;
color: #ffffff;
padding: 8px 16px;
z-index: 1000;
text-decoration: none;
}
.skip-link:focus {
top: 0;
}
</style>
</head>
<body>
<!-- 1. Keyboard Accessibility Skip Link -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<!-- 2. Global Site Header -->
<header>
<h1>State University Student Portal</h1>
<!-- Primary Navigation Landmark -->
<nav aria-label="Primary Navigation">
<ul>
<li><a href="/dashboard">Dashboard</a></li>
<li><a href="/courses">My Courses</a></li>
<li><a href="/grades">Grades & Records</a></li>
<li>
<button id="user-menu-button" aria-haspopup="true" aria-expanded="false" aria-controls="user-dropdown">
Account Options
</button>
<ul id="user-dropdown" aria-labelledby="user-menu-button" hidden>
<li><a href="/profile">Profile Settings</a></li>
<li><a href="/security">Security</a></li>
<li><a href="/logout">Sign Out</a></li>
</ul>
</li>
</ul>
</nav>
</header>
<!-- 3. Tangential Content / Sidebar Landmark -->
<aside aria-label="Quick Tools and Utilities">
<h2>Student Resources</h2>
<ul>
<li><a href="/library">University Library</a></li>
<li><a href="/calendar">Academic Calendar</a></li>
<li><a href="/helpdesk">IT Support</a></li>
</ul>
</aside>
<!-- 4. Primary Page Content Landmark -->
<main id="main-content" tabindex="-1">
<article>
<h2>Autumn Semester Overview</h2>
<p>Welcome back! Below are your active modules and administrative notices.</p>
<!-- Section A: Courses -->
<section aria-labelledby="enrolled-courses-heading">
<h3 id="enrolled-courses-heading">Enrolled Modules</h3>
<ul>
<li><strong>CS301:</strong> Advanced Database Systems</li>
<li><strong>CS305:</strong> Web Architecture & Development</li>
<li><strong>MATH201:</strong> Linear Algebra II</li>
</ul>
</section>
<!-- Section B: Deadlines -->
<section aria-labelledby="deadlines-heading">
<h3 id="deadlines-heading">Upcoming Deliverables</h3>
<ul>
<li>CS305 Page Layout Assignment β Due October 20</li>
<li>MATH201 Problem Set 4 β Due October 24</li>
</ul>
</section>
</article>
</main>
<!-- 5. Global Site Footer -->
<footer>
<p>© 2026 State University. All rights reserved.</p>
<nav aria-label="Footer Legal Links">
<ul>
<li><a href="/privacy">Privacy Statement</a></li>
<li><a href="/accessibility">Accessibility Commitment</a></li>
</ul>
</nav>
</footer>
</body>
</html>


