Lecture 4 - HTML Boilerplate

HTML Foundations

HTML Boilerplate

CSCI 3403 - Web Programming

Class 4 | Fall 2025

bobby reed | bobby.reed@okcu.edu

Today's Agenda πŸ“‹

Goal: By the end of today, you'll be able to write HTML boilerplate from memory!

Quick Recap πŸ”„

What We've Covered So Far:

Today's Build: We're creating the foundation that EVERY web page needs!

Why HTML Boilerplate? πŸ€”

Think of HTML boilerplate as the skeleton of your webpage.

Without proper boilerplate: Your page might render incorrectly, have encoding issues, or be inaccessible to screen readers!

Creating Your First HTML File πŸ“

Let's Get Started!

Follow Along:

  1. Create a new folder: html-boilerplate
  2. Inside, create a file: index.html
Pro Tip: Always name your homepage index.html - web servers look for this file by default!

File Extensions Matter! The .html extension tells the computer this is an HTML file.

The DOCTYPE Declaration πŸ“œ

The very first line of EVERY HTML document!

<!DOCTYPE html>

What does it do?

Historical Note: Older HTML versions had complex doctypes:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
Aren't we lucky to have HTML5? πŸ˜…

The HTML Element 🏠

The root element - everything else goes inside!

<!DOCTYPE html>
<html lang="en">
    <!-- All other elements go here -->
</html>

The lang Attribute

The HEAD Element 🧠

The brain of your webpage - contains metadata!

<head>
    <meta charset="UTF-8">
    <title>My First Webpage</title>
</head>

What goes in the HEAD?

Remember: Nothing in the HEAD is visible on the page itself!

Character Encoding 🌍

<meta charset="UTF-8">

Why UTF-8?

Without UTF-8: Café instead of CafΓ©

With UTF-8: Café displays correctly! ✨

The TITLE Element 🏷️

<title>My Amazing Website</title>

Where does it appear?

Best Practice: Keep titles descriptive but concise (50-60 characters)

No title? Browser shows the filename (index.html) - not very user-friendly!

The BODY Element πŸ‘οΈ

Everything visible goes here!

<body>
    <h1>Hello World!</h1>
    <p>This is my first webpage!</p>
    <!-- All visible content goes here -->
</body>

Body Content Includes:

Complete HTML Boilerplate 🎯

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>My First Webpage</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

Memorize This Structure!

You'll write this hundreds of times in your web development journey!

Live Coding Demo πŸ’»

Let's Build Together!

Follow along as we create an HTML file from scratch!

Steps:

  1. Create the file
  2. Add DOCTYPE
  3. Add HTML element with lang
  4. Add HEAD with meta and title
  5. Add BODY with content
  6. Open in browser

Opening HTML in Browser 🌐

Three Methods:

  1. Drag & Drop: Drag file into browser address bar
  2. Double Click: Find file in folder and double-click
  3. Terminal/Command Line:
    • Mac: open index.html
    • Windows (WSL): explorer.exe index.html
    • Linux: google-chrome index.html
Refresh Tip: Use Ctrl+R (Windows) or Cmd+R (Mac) to reload after changes!

VS Code Magic Trick ✨

The Emmet Abbreviation

Try This:

  1. Create a new .html file in VS Code
  2. Type ! and press Enter
  3. Boom! Full boilerplate appears!
But wait! Don't rely on this shortcut yet!

Build muscle memory by typing it out manually first. You won't always have VS Code!

Note: VS Code adds viewport meta tag - we'll learn about this when we cover responsive design!

Practice Activity πŸ‹οΈ

Build Your Muscle Memory!

5-Minute Challenge:

  1. Delete everything in your index.html
  2. Write the complete boilerplate from memory
  3. Add a unique title and h1 message
  4. Open in browser to verify it works
  5. Repeat 3 times!
Partner Check: Trade with your neighbor and check each other's boilerplate!

HTML Validation βœ…

W3C Markup Validator

Check if your HTML is valid and follows standards!

Website: validator.w3.org

Why Validate?

Try It Now:

Copy your HTML and paste it into the validator!

Common Boilerplate Mistakes ⚠️

Avoid These Pitfalls!

Pro Tip: Always validate your HTML to catch these errors!

Homework Assignment πŸ“

Due Before Next Class (Tuesday):

Part 1: Video & Practice

  1. Watch: "HTML and CSS for Beginners Part 2: Building your first web page!"
  2. Follow along and create your own HTML page with proper boilerplate

Part 2: Validation

  1. Run your website through the W3 HTML Validator
  2. Take a screenshot of your validation results
  3. Submit screenshot to D2L discussion as a new topic

Part 3: Peer Review

  1. Respond to 2 other student posts
  2. Compare and contrast their results with your own
  3. Offer helpful feedback if they have errors!
Grading: Green checkmark in validator + thoughtful peer responses = Full credit!

Today's Takeaways πŸŽ“

You Can Now:

Next Class: Working with Text - Headings, Paragraphs, and More!

Practice Challenge: Write the boilerplate 5 times before next class - aim for under 30 seconds!

Questions? πŸ€”

Let's Review Together!

Office Hours: Mon/Wed 9-11 AM | Tue/Thu 1-2:30 PM

SSM 204A | bobby.reed@okcu.edu

Remember: There are no stupid questions in web development!