CSE326Semester 1 • 2 CreditsCore Subjects

Internet Programming

Internet Programming covers HTML5, semantic HTML and forms, CSS-based responsive design, JavaScript, DOM manipulation, browser APIs, debugging, and deployment using GitHub Pages.

6 Units • Notes • Model Answers • MCQs
Select Course Unit (6 Units)
Active: Unit 1
Unit 1:HTML5 Fundamentals & Web Architecture
12 min read•High-Yield Unit Guide

HTML5 Fundamentals & Web Architecture

Unit 1 Exam Focus & Core Takeaways

Review the core definitions, standard architectures, and syntax patterns below. Pay special attention to sections highlighted with bullet points for your mid-term and end-term subjective questions.

Unit 1: HTML5 Fundamentals & Web Architecture

1. Introduction: The Architecture of the World Wide Web

The World Wide Web (WWW) is an expansive, globally distributed information space operating atop the physical infrastructure of the Internet. While the Internet constitutes the global network of interconnected hardware (routers, fiber-optic cables, switches, and servers communicating via the TCP/IP protocol suite), the Web is an application-layer service built upon it, conceptualized by Tim Berners-Lee in 1989.

CODE
+-------------------------------------------------------------+
|                     APPLICATION LAYER                       |
|   HTTP / HTTPS (Hypertext Transfer Protocol)               |
|   HTML5 Documents, CSS3 Stylesheets, JavaScript APIs        |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                      TRANSPORT LAYER                        |
|   TCP (Transmission Control Protocol)                       |
|   Reliable, ordered, error-checked byte stream delivery     |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                       INTERNET LAYER                        |
|   IP (Internet Protocol: IPv4 / IPv6)                       |
|   Packet routing and logical host addressing                |
+-------------------------------------------------------------+

The Anatomy of a Uniform Resource Locator (URL)

Every resource on the web is located via a standardized URL address:
https://www.example.com:443/courses/web-dev?(sort=desc)#syllabus\text{https}://\text{www.example.com}:443/\text{courses}/\text{web-dev}?(\text{sort}=\text{desc})\#\text{syllabus}

  • Scheme / Protocol (https://): Declares the communication protocol (HTTPS ensures TLS/SSL encryption over default port 443; unencrypted HTTP defaults to port 80).
  • Host / Domain Name (www.example.com): Human-readable server alias resolved by the Domain Name System (DNS) into a numeric IP address (e.g., 93.184.216.34).
  • Port (:443): Numerical network socket identifier directing traffic to the web server process (usually omitted when standard default ports 80/443 are used).
  • Path (/courses/web-dev): Hierarchical route specifying the requested file or resource on the server.
  • Query String (?sort=desc): Key-value parameter pairs passing search filters or state to the server.
  • Fragment Identifier (#syllabus): Client-side bookmark that scrolls the browser viewport directly to the HTML element bearing id="syllabus". Fragments are never transmitted to the server in HTTP requests.

2. The Client-Server Architecture & Request-Response Cycle

Web communication follows a strict client-server paradigm orchestrated through stateless HTTP transactions:

CODE
[ Web Browser (Client) ]                                  [ Web Server (Nginx / Apache) ]
         |                                                               |
         | --- 1. DNS Lookup (Resolves domain to IP) ------------------> |
         |                                                               |
         | --- 2. TCP 3-Way Handshake (SYN -> SYN-ACK -> ACK) ---------> |
         |                                                               |
         | --- 3. TLS Handshake (Cipher suite negotiation & certs) ----> |
         |                                                               |
         | --- 4. HTTP GET Request (Headers, User-Agent, Cookies) -----> |
         |                                                               |
         | <--- 5. HTTP Response (Status 200 OK, HTML Payload) --------- |
         |                                                               |
         | --- 6. Parsing HTML, discovering CSS/JS/images -------------> |
         |                                                               |
         | <--- 7. Auxiliary Asset Responses -------------------------- |

Key HTTP Methods

  • GET: Safe and idempotent retrieval of a resource. Contains no request body; parameters are encoded in the URL query string.
  • POST: Submits data payload (e.g., form submissions, file uploads) in the HTTP request body to create or mutate server state; non-idempotent.
  • PUT / PATCH: Replaces an entire resource (PUT) or applies partial modifications (PATCH).
  • DELETE: Removes the targeted resource.

Standard HTTP Status Code Categories

  • 1xx (Informational): Request received, continuing process (e.g., 101 Switching Protocols).
  • 2xx (Success): Action successfully received and understood (e.g., 200 OK, 201 Created, 204 No Content).
  • 3xx (Redirection): Further action required to complete request (e.g., 301 Moved Permanently, 304 Not Modified).
  • 4xx (Client Errors): Request contains syntax errors or cannot be fulfilled (e.g., 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found).
  • 5xx (Server Errors): Server failed to fulfill a valid request (e.g., 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable).

3. HTML5 Document Anatomy & Standards

HyperText Markup Language (HTML) is the foundational declarative language that dictates the structural hierarchy and semantic meaning of web content. HTML is not a programming language; it contains no conditional loops, variable assignments, or algorithmic control flow.

The Canonical HTML5 Boilerplate

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Master foundational HTML5 and client-server concepts.">
    <title>Internet Programming | Unit 1</title>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
    <header>
      <h1>Web Development Fundamentals</h1>
    </header>
    <main>
      <p>Welcome to modern full-stack engineering.</p>
    </main>
    <footer>
      <p>&copy; 2026 Academic Study Portal</p>
    </footer>
    <script src="app.js"></script>
  </body>
</html>

Essential Root Elements Explained:

  1. <!DOCTYPE html>: The document type declaration. In HTML5, this single short string forces web rendering engines into standards-compliant mode rather than backwards-compatible "quirks mode".
  2. <html lang="en">: The root container enclosing all elements. The lang attribute informs screen readers and search engines of the primary human language.
  3. <head>: Houses document metadata, character sets, viewport scaling parameters, SEO descriptors, and external stylesheet links that are not rendered visibly in the viewport.
  4. <meta charset="UTF-8">: Specifies the character encoding format, guaranteeing proper rendering of international scripts, symbols, and mathematical notations.
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">: Crucial for responsive design; aligns the virtual viewport width to the device's physical screen width and establishes a 1:1 initial zoom ratio.
  6. <body>: Contains the entire visual and interactive structure parsed and rendered directly by the browser's Document Object Model (DOM) engine.

4. HTML Elements, Tags & Attributes

Tag Syntax Anatomy

An HTML element typically comprises an opening tag, optional attributes, enclosed content, and a closing tag:

html
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Visit Website</a>
  • Opening Tag (<a>): Denotes the beginning of an anchor element.
  • Attributes (href, target, rel): Key-value modifiers supplying configuration data.
  • Content (Visit Website): The text or nested elements enclosed between tags.
  • Closing Tag (</a>): Denotes the termination of the element.

Void (Self-Closing) Elements

Void elements cannot contain child content or closing tags. In HTML5, they do not require trailing slashes:

  • <meta>, <link>, <img>, <input>, <br>, <hr>, <source>, <area>, <param>.

Common Global Attributes

Every HTML element supports standard global attributes:

  • id: Unique identifier across the entire DOM tree; must be unique per document. Used for CSS styling (#id), JavaScript lookups (document.getElementById), and URL anchor jumps.
  • class: Non-unique identifier grouping multiple elements under shared CSS classes (.class) or JavaScript queries.
  • title: Provides advisory tooltip text displayed on cursor hover.
  • data-* (Custom Data Attributes): Enables embedding private application data accessible in JavaScript via the dataset API (e.g., data-user-id="4082").
  • tabindex: Regulates sequential keyboard tab navigation order.

Headings & Text Hierarchy

HTML provides six levels of structural headings, ranging from <h1> (highest conceptual importance) to <h6> (lowest). Best practices dictate using exactly one <h1> per web page to define the primary subject for search engine optimization (SEO) and screen readers.

  • <p>: Delimits paragraphs with default block margins.
  • <strong>: Conveys strong semantic importance, seriousness, or urgency (rendered bold by default).
  • <em>: Conveys verbal emphasis that shifts sentence meaning (rendered italic by default).
  • <blockquote>: Represents an extended quotation from an external source, paired with a cite attribute.
  • <code> and <pre>: Formats computer code snippets; <pre> preserves exact whitespace indentations and newlines.

Links are instantiated via the <a> element using the href attribute:

html
<!-- External Link with Security Flags -->
<a href="https://externalsite.com" target="_blank" rel="noopener noreferrer">External Portal</a>

<!-- Internal Bookmark Fragment Jump -->
<a href="#target-heading">Jump to Section</a>

<!-- Communication Protocols -->
<a href="mailto:admin@lpu.in">Send Email</a>
<a href="tel:+919876543210">Call Helpdesk</a>

[!WARNING]
When using target="_blank" to open links in a new browser tab, always append rel="noopener noreferrer". Without noopener, the newly opened page gains access to the originating window's window.opener object, introducing severe tab-nabbing cross-site scripting vulnerabilities.


6. Structured Lists & Tables

Lists

  1. Unordered List (<ul>): Order of items does not alter meaning; rendered with bullets. Encloses list items (<li>).
  2. Ordered List (<ol>): Order is mathematically or procedurally sequential; rendered with numbers or Roman numerals. Supports start and type attributes.
  3. Description List (<dl>): Groups term titles (<dt>) with term descriptions (<dd>), ideal for glossaries or metadata key-value displays.

Accessible Data Tables

Tables display tabular data structured across rows and columns. Never use tables for page layout!

html
<table>
  <caption>Student Academic Performance Summary</caption>
  <thead>
    <tr>
      <th scope="col">Roll Number</th>
      <th scope="col">Subject</th>
      <th scope="col">Grade</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>12001</td>
      <td>Internet Programming</td>
      <td>A+</td>
    </tr>
    <tr>
      <td>12002</td>
      <td>Data Structures</td>
      <td>O</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="2">Total Passing Percentage</td>
      <td>98.5%</td>
    </tr>
  </tfoot>
</table>
  • <caption>: Accessible table heading read by screen readers.
  • <thead>, <tbody>, <tfoot>: Explicit semantic structural sections.
  • <th>: Header cell; the scope="col" or scope="row" attribute associates header cells with corresponding data cells.
  • colspan / rowspan: Merges cells across multiple horizontal columns or vertical rows.

7. Multimedia & Vector Graphics

Images (<img>)

Images are embedded raster elements that pull external assets via the src attribute:

html
<img src="diagram.webp" alt="Client-server request response sequence diagram" width="800" height="400" loading="lazy">
  • alt (Alternative Text): Critical for accessibility. Read aloud by assistive screen readers and displayed if asset loading fails. Purely decorative images must use an empty attribute (alt="").
  • width & height: Explicit pixel dimensions reserve layout space before download completes, preventing jarring Cumulative Layout Shift (CLS).
  • loading="lazy": Defers downloading offscreen images until the user scrolls near them, dramatically improving initial page load speeds.

Native Audio & Video (<audio>, <video>)

HTML5 introduced native media players without requiring third-party browser plugins:

html
<video controls poster="preview.jpg" width="640">
  <source src="lecture.mp4" type="video/mp4">
  <source src="lecture.webm" type="video/webm">
  <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
  Your browser does not support HTML5 video playback.
</video>
  • Attributes: controls (displays play/pause/volume UI), autoplay, loop, muted (required for programmatic autoplay), poster (thumbnail placeholder image).
  • Multiple <source> tags allow browsers to select the most efficient codec supported (WebM vs MP4).

Scalable Vector Graphics (SVG)

SVG is an XML-based vector image format. Unlike raster formats (JPEG, PNG) that pixelate when magnified, SVG paths mathematically recompute at any zoom level without quality loss:

html
<svg viewBox="0 0 100 100" width="100" height="100" role="img" aria-label="Blue circular badge">
  <circle cx="50" cy="50" r="40" fill="#0066cc" />
</svg>
  • Advantages: Infinitely scalable, extremely lightweight, styleable via CSS, and scriptable via JavaScript.

8. Common Pitfalls & Practical Traps

  1. Omitting the Image alt Attribute:
    • Error: <img src="logo.png">
    • Consequence: Screen readers announce the full cryptographic raw file path (e.g., "logo-v2-final-3829.png"), degrading accessibility and hurting SEO rankings.
  2. Missing <!DOCTYPE html>:
    • Consequence: Forces browsers into quirks mode, rendering box sizing and typography according to 1990s Netscape/IE bugs.
  3. Using Headings purely for Visual Font Size:
    • Error: Using an <h5> just because you want small text, or jumping directly from <h1> to <h4>.
    • Consequence: Destroys document outline hierarchy for screen reader users who navigate pages by skipping through heading levels.
  4. Target _blank Security Vulnerability:
    • Error: <a href="..." target="_blank"> without rel="noopener noreferrer".
    • Consequence: Leaves applications open to reverse tab-nabbing phishing exploits.

9. Quick Revision Table: HTML5 Elements & Standards

Element / ConceptCategorySemantic PurposeKey Attributes
<!DOCTYPE html>DeclarationTriggers standards-compliant browser renderingN/A
<meta charset="UTF-8">Document MetadataSets character encoding for international textcharset
<meta name="viewport">Document MetadataRegulates mobile scaling & viewport dimensionsname, content
<a>Inline HyperlinkBridges web pages, protocols, or page anchorshref, target, rel
<img>Void Media ElementEmbeds external raster imagessrc, alt, loading, width, height
<video> / <audio>Block Media ElementNative playback for video/audio streamscontrols, poster, muted, autoplay
<table>Tabular StructureRepresents two-dimensional structured datacaption, colspan, rowspan
<svg>Vector GraphicsXML-based vector shapes & iconsviewBox, xmlns, fill, stroke