# Zero to Web Developer: HTML, CSS & HTML+
### The Complete, Zero-Jargon Beginner's Guide to Building Websites & Real Apps

**Official Beginner's Book for Standard HTML5, CSS3 & HoneyScript (`HTML+`) v2.2.0**
*"Don't break the internet or workflows. Extend it."*
Published by **Underlisted X** · [underlisted-x.com/honeyscript/book/](https://underlisted-x.com/honeyscript/book/)

---

## Table of Contents

- [Preface: Welcome to the Web (No Math Genius Required)](#preface)
- **Part I — Standard HTML5 (Structure & Meaning)**
  1. [Chapter 1: How the Internet & Web Pages Actually Work](#chapter-1)
  2. [Chapter 2: HTML Is Just Labeled Boxes](#chapter-2)
  3. [Chapter 3: Organizing Real Pages (Lists, Semantic Tags, `id` & `class`)](#chapter-3)
  4. [Chapter 4: Collecting User Input with HTML5 Forms](#chapter-4)
- **Part II — Standard CSS3 (Design & Layout)**
  5. [Chapter 5: Styling Your Page with Pure `<style>`](#chapter-5)
  6. [Chapter 6: The CSS Box Model (Margin, Border & Padding)](#chapter-6)
  7. [Chapter 7: Modern Layouts Made Easy (Flexbox & CSS Grid)](#chapter-7)
  8. [Chapter 8: Making Sites Look Great on Phones (Responsive Design)](#chapter-8)
- **Part III — Extending Your Skills with HTML+ (Zero-JS Real Apps)**
  9. [Chapter 9: Memory Boxes (`<var>`, `<const>`, `<array>`, and the `$` Rule)](#chapter-9)
  10. [Chapter 10: Making Pages React with `<rules>`](#chapter-10)
  11. [Chapter 11: Dynamic Lists & Live Typing (`<each>` & `bind`)](#chapter-11)
  12. [Chapter 12: Saving Data Forever (`<form>` + Embedded `<db>`)](#chapter-12)
  13. [Chapter 13: Reusable Components & Built-In Tests (`<define>`, SRI & `<test>`)](#chapter-13)
- **Part IV — Shipping to the Real World**
  14. [Chapter 14: One File, Four Targets (Web, Static, Gmail Email & `.exe`)](#chapter-14)
  15. [Appendix: Complete HTML5, CSS3 & HTML+ Cheat Sheet](#appendix)

---

<a id="preface"></a>
## Preface: Welcome to the Web (No Math Genius Required)

If you have never written a single line of code in your life, **you are in the exact right place**.

A lot of beginners give up on web development in their first week — not because they aren't smart, but because most tutorials throw 12 tools at you on Day 1: HTML, CSS, JavaScript, Node.js, npm, React, TypeScript, Vite, Tailwind, SQL, and Docker.

This book takes a calmer, smarter path — because **HTML+ is not a separate language from HTML5 and CSS3. They are the exact same thing.**

HTML+ **is** standard HTML5 and CSS3, simply extended with a small set of new built-in components (`<var>`, `<rules>`, `<each>`, `<db>`, `<define>`, and `<test>`). Every standard HTML5 tag and every standard CSS3 rule you learn in this book works identically inside HTML+.

1. **Parts I & II (Core HTML5 & CSS3):** You will learn the universal foundations of the web — tags, forms, colors, the box model, Flexbox, CSS Grid, and responsive mobile design.
2. **Part III (The New Extended Components):** You will unlock the extended HTML+ components that sit right beside your normal HTML5 and CSS3 — giving you variables, click rules, databases, reusable tags, and built-in tests **without ever switching languages or installing JavaScript frameworks**.
3. **Part IV (Shipping):** You will ship one clean file as a live zero-JS web app, a static website, a Gmail/Outlook HTML email, and even a standalone `.exe` program.

> **"Don't break the internet or workflows. Extend it."**

Take your time, type the examples out yourself in [HoneyScript Sandbox](https://underlisted-x.com/honeyscript/sandbox/) or any text editor, and enjoy watching your own pages come to life.

---

<a id="chapter-1"></a>
## Chapter 1: How the Internet & Web Pages Actually Work

Before writing code, let's demystify what actually happens when you visit a website.

### The Restaurant Analogy
Think of the web like ordering at a restaurant:
- **Your Browser (Chrome, Safari, Firefox)** is **you** sitting at the table.
- **A URL** (like `https://underlisted-x.com/honeyscript/`) is the **restaurant's address and table order**.
- **A Server** is the **kitchen** — a computer sitting somewhere in the world that stores the website's files and hands them back when asked.
- **HTML & CSS Files** are the **meal** the kitchen sends to your browser so it knows what to show on your screen.

### A Webpage Is Just a Plain Text File
There is no magic binary mystery behind a website. A webpage is literally a **plain text file** (like a `.txt` note), saved with a `.html` extension (for standard web pages) or `.htmp` / `.hny` (for HTML+ apps).

Here is a complete, valid webpage:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>My First Website</title>
</head>
<body>
  <h1>Hello, Internet!</h1>
  <p>I built this page from scratch.</p>
</body>
</html>
```

Look at the two main sections inside `<html>`:
- **`<head>` (Behind the Scenes):** Information *about* the page — its browser tab `<title>`, character encoding (`utf-8` so emojis and accents work), and stylesheets. Visitors don't see `<head>` directly on the page.
- **`<body>` (What Visitors See):** Every heading, paragraph, image, button, and form visible on the screen lives inside `<body>`.

> **Try It Yourself:** Create a file on your computer called `hello.html`, paste the code above, and double-click it. Your browser will open your very own webpage offline!

---

<a id="chapter-2"></a>
## Chapter 2: HTML Is Just Labeled Boxes

HTML stands for **HyperText Markup Language**. Forget the scary acronym — **HTML is just labeled boxes**.

Every box has an **opening tag** (`<p>`) and a **closing tag** (`</p>`), with your content inside:

```html
<h1>Main Page Title</h1>
<h2>A Smaller Section Heading</h2>
<p>This is a normal paragraph of text. You can <strong>bold</strong> or <em>italicize</em> words.</p>
```

### Links (`<a>`) and Images (`<img>`)
Some tags need extra details called **attributes** — written as `name="value"` inside the opening tag:

```html
<!-- A clickable link -->
<a href="https://underlisted-x.com/honeyscript/">Visit HoneyScript</a>

<!-- An image (self-closing — no closing </img> tag needed!) -->
<img src="/honeyscript/honey-icon.png" alt="Honey AI Logo" width="64" height="64" />
```

- `href="..."` tells a link *where* to go.
- `src="..."` tells an image *which* file to load.
- `alt="..."` describes the image for screen readers and shows up if the image fails to load. Always include `alt`!

### Nesting: Boxes Inside Boxes
Just like you can put small boxes inside a bigger moving box, you can put HTML tags inside other HTML tags. **Rule:** Always close the inner box *before* closing the outer box.

```html
<!-- GOOD: inner <strong> closes before outer <p> -->
<p>Welcome to <strong>My Studio</strong>!</p>

<!-- BAD: tags overlap -->
<p>Welcome to <strong>My Studio</p>!</strong>
```

> **Try It Yourself:** Build a mini "About Me" page with an `<h1>` for your name, a `<p>` bio with one `<strong>` word, and an `<a>` link to your favorite website.

---

<a id="chapter-3"></a>
## Chapter 3: Organizing Real Pages (Lists, Semantic Tags, `id` & `class`)

Real websites aren't just walls of paragraphs. They have navigation bars, bullet lists, cards, and footers.

### Bullet & Numbered Lists
- `<ul>` = **Unordered List** (bullets)
- `<ol>` = **Ordered List** (1, 2, 3)
- `<li>` = **List Item** (each individual line)

```html
<h2>My Learning Checklist</h2>
<ul>
  <li>Learn HTML5 structure</li>
  <li>Master CSS3 layout</li>
  <li>Build my first zero-JS app in HTML+</li>
</ul>
```

### Semantic Tags (Meaningful Boxes)
Instead of wrapping everything in generic `<div>` boxes, HTML5 gives you descriptive container tags that help both humans and search engines understand your page:

```html
<header>Top brand &amp; navigation bar</header>
<main>
  <section>
    <article>A blog post, card, or product</article>
  </section>
</main>
<footer>Copyright &amp; bottom links</footer>
```

### `id` vs. `class`: The Name Tag Rule
When you want to style or interact with specific boxes later, you label them with `id` or `class`:
- **`id="hero-title"`** — **Unique.** Like a passport number: only *one* element on the page should have that exact `id`.
- **`class="card"`** — **Reusable.** Like a team jersey: *dozens* of elements can share the same `class`.

```html
<h1 id="hero-title">Featured Projects</h1>
<article class="card">Project One</article>
<article class="card">Project Two</article>
```

---

<a id="chapter-4"></a>
## Chapter 4: Collecting User Input with HTML5 Forms

Whenever a website asks for your name, email, search query, or login, it uses an HTML5 **`<form>`**.

```html
<form id="contact-form">
  <label for="user-name">Your Name</label>
  <input id="user-name" name="name" type="text" required minlength="2" placeholder="e.g. Maya" />

  <label for="user-email">Email Address</label>
  <input id="user-email" name="email" type="email" required placeholder="you@domain.com" />

  <label for="seats">Number of Seats</label>
  <input id="seats" name="seats" type="number" min="1" max="10" value="1" />

  <button type="submit">Send Request</button>
</form>
```

### Built-In HTML5 Validation (Free!)
Notice those helpful attributes right on the `<input>` tags:
- `type="email"` — Automatically knows an email needs `@` and a domain.
- `type="number"` — Only allows numbers (and shows a number keypad on phones!).
- `required` — Stops empty submissions.
- `minlength="2"` / `min="1"` / `max="10"` — Enforces length and number ranges automatically.

> **Why this matters later:** In Part III, HTML+ reads these **exact same standard HTML5 attributes** to validate your forms automatically with `valid-form("#contact-form")`!

---

<a id="chapter-5"></a>
## Chapter 5: Styling Your Page with Pure `<style>`

If HTML is the **skeleton and walls** of a house, **CSS (Cascading Style Sheets)** is the **paint, lighting, and furniture**.

You write CSS inside a `<style>` tag using simple rules: **pick a box**, then list `property: value;` pairs inside `{ ... }`:

```html
<style>
  body {
    background: #020504;
    color: #f4f7f5;
    font-family: Inter, system-ui, sans-serif;
    line-height: 1.6;
  }

  #hero-title {
    color: #34e89e;
    font-size: 36px;
  }

  .card {
    background: #08100c;
    border: 1px solid #34e89e;
    border-radius: 8px;
  }
</style>
```

### The 3 Essential CSS Selectors
1. **`body`, `h1`, `p`** (Tag selector) — Styles *every* tag of that kind.
2. **`.card`** (Dot = Class selector) — Styles *every* element with `class="card"`.
3. **`#hero-title`** (Hash = ID selector) — Styles the *one* element with `id="hero-title"`.

### Beginner Design Tips That Instantly Look Pro
- **Give text room to breathe:** Always set `line-height: 1.5` or `1.6` on `body`.
- **Limit line width:** Long lines are tiring to read. Use `max-width: 65ch;` on paragraphs.
- **High contrast:** Light text (`#f4f7f5`) on dark obsidian (`#020504`), or dark charcoal (`#111815`) on crisp white (`#ffffff`).

---

<a id="chapter-6"></a>
## Chapter 6: The CSS Box Model (Margin, Border & Padding)

Every single element on a webpage — even a word or a button — is a **rectangle** made of 4 layers from inside out:

1. **Content:** The text or image itself.
2. **Padding:** Breathing room *inside* the box, between the content and the border.
3. **Border:** The visible outline around the box.
4. **Margin:** Empty space *outside* the box, pushing neighboring boxes away.

```html
<style>
  /* Always put this at the top of your CSS! */
  * {
    box-sizing: border-box;
  }

  .box {
    width: 300px;
    padding: 20px;        /* Space INSIDE the border */
    border: 2px solid #34e89e;
    margin: 16px;         /* Space OUTSIDE the border */
    background: #08100c;
  }
</style>
```

### Why `* { box-sizing: border-box; }` Saves Your Sanity
By default, if you make a box `width: 300px` and add `padding: 20px`, browsers make it `340px` wide (breaking your layout!). Adding `box-sizing: border-box;` tells the browser: *"Keep the total width strictly 300px, including padding and border."* Every professional web developer uses this on every site.

---

<a id="chapter-7"></a>
## Chapter 7: Modern Layouts Made Easy (Flexbox & CSS Grid)

Historically, centering a box or placing three cards side-by-side was notoriously tricky. Modern CSS gives you two clean superpowers:

### 1. Flexbox (`display: flex`) — For 1-Dimensional Rows & Navbars
Use Flexbox whenever you want items lined up neatly in a single row (like a navigation bar or a row of buttons):

```css
.navbar {
  display: flex;
  justify-content: space-between; /* Brand on left, links on right */
  align-items: center;            /* Vertically centered */
  gap: 16px;                      /* Clean space between items */
  flex-wrap: wrap;                /* Wrap nicely on small screens */
}
```

### 2. CSS Grid (`display: grid`) — For 2-Dimensional Card Grids
Use CSS Grid whenever you want a neat multi-column grid of cards that automatically adapts to any screen width:

```css
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
```

Read that one magic line out loud:
*"Fit as many columns as possible, where each card is at least `260px` wide and shares leftover space equally (`1fr`)."*
On a desktop, you get 3–4 columns. On a tablet, 2 columns. On a phone, 1 clean full-width column — **automatically!**

---

<a id="chapter-8"></a>
## Chapter 8: Making Sites Look Great on Phones (Responsive Design)

Over half of all web visitors are on phones. Three simple habits keep your site looking sharp on every screen size:

1. **Include the Viewport Meta Tag** in `<head>`:
   ```html
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   ```
2. **Prevent Horizontal Overflow:**
   ```css
   html, body { overflow-x: clip; }
   img { max-width: 100%; height: auto; }
   ```
3. **Use `@media` Queries for Small Screens:**
   ```css
   @media (max-width: 640px) {
     body { padding: 16px; }
     h1 { font-size: 28px; }
   }
   ```

> **Congratulations!** You now know the real, timeless foundations of **HTML5 and CSS3**. Everything from here on builds *directly* on what you just learned — without throwing any of it away.

---

<a id="chapter-9"></a>
## Chapter 9: Memory Boxes (`<var>`, `<const>`, `<array>`, and the `$` Rule)

Here is the best part: **you are not switching to a new language.** HTML+ **is** the exact same HTML5 and CSS3 you just mastered — simply extended with a few new built-in components.

Change the top line from `<!DOCTYPE html>` to **`<!DOCTYPE html+>`**, and your normal HTML5 + CSS3 file immediately gains **memory boxes** using `<var />`:

```html
<!DOCTYPE html+>
<var player="Maya" coins="100" vip="true" />
<const max-coins="9999" />

<h1>Welcome back, $player!</h1>
<p>Coins: $coins (Limit: $max-coins)</p>
```

### The One Golden `$` Rule
- **When you CREATE a variable**, leave `$` **off**: `<var coins="100" />`
- **When you USE or UPDATE it**, put `$` **on**: `$coins`
- **Locked constants** (`<const />`) can never be accidentally overwritten.
- **Literal dollar sign before a variable:** Write `\$$coins` to print `$100`. Plain prices like `$25` stay normal text automatically.

---

<a id="chapter-10"></a>
## Chapter 10: Making Pages React with `<rules>`

In traditional web development, making a button actually *do* something meant learning JavaScript (`addEventListener`, `document.querySelector`, `let`, `===`).

In HTML+, you keep `<style>` **100% pure visual CSS**, and put **behavior** inside a **`<rules>`** block using the exact same `#id` selectors you learned in Chapter 5:

```html
<!DOCTYPE html+>
<var cash="500" />

<p id="hud">Balance: \$$cash</p>
<button id="earn-btn">Earn +$50</button>
<button id="buy-btn">Buy Coffee ($25)</button>

<style>
  body { background: #020504; color: #f4f7f5; font-family: sans-serif; padding: 28px; }
  #hud { font-size: 24px; color: #34e89e; }
  button { padding: 10px 16px; border: 1px solid #34e89e; background: #08100c; color: #fff; cursor: pointer; margin-right: 8px; }
</style>

<rules>
  #earn-btn:click {
    $cash: calc($cash + 50);
  }

  #buy-btn:click {
    @if ($cash >= 25) {
      $cash: calc($cash - 25);
      #hud { color: #68f7b8; content: "Enjoy your coffee! Balance: \$$cash"; }
    } @else {
      #hud { color: #f87171; content: "Not enough funds! Balance: \$$cash"; }
    }
  }
</rules>
```

Look how natural that reads:
- `#earn-btn:click` → *"When `#earn-btn` is clicked..."*
- `$cash: calc($cash + 50);` → *"...add 50 to `$cash`."*
- `@if ($cash >= 25) { ... } @else { ... }` → *"If `$cash` is at least 25, subtract 25; otherwise show a warning."*

---

<a id="chapter-11"></a>
## Chapter 11: Dynamic Lists & Live Typing (`<each>` & `bind`)

Combine an `<array />` list, an `<input bind="$var" />`, and an `<each>` loop to build a live interactive roster or to-do list:

```html
<!DOCTYPE html+>
<array tasks="Learn HTML5, Master CSS Grid, Ship HTML+ App" />
<var draft="" />

<h2>My Tasks ({len($tasks)})</h2>
<input id="task-in" type="text" bind="$draft" placeholder="Add a new task..." />
<button id="add-btn">Add Task</button>

<each item="t" in="$tasks">
  <div class="task-row">✓ $t</div>
</each>

<style>
  body { background: #020504; color: #f4f7f5; font-family: sans-serif; padding: 28px; }
  .task-row { padding: 10px 12px; margin: 6px 0; background: #08100c; border: 1px solid #34e89e; }
</style>

<rules>
  #add-btn:click {
    @if (len(trim($draft)) > 0) {
      $tasks: add(trim($draft));
      $draft: "";
    }
  }
</rules>
```

---

<a id="chapter-12"></a>
## Chapter 12: Saving Data Forever (`<form>` + Embedded `<db>`)

Remember the HTML5 `<form>` you built in Chapter 4? Now attach a zero-setup **embedded ACID database (`<db />`)** so submissions save permanently to disk:

```html
<!DOCTYPE html+>
<db id="store" src="./waitlist.hdb" />
<var name="" email="" count="0" msg="Join our launch list." ok="false" />

<form id="signup">
  <input name="name" type="text" bind="$name" required="true" minlength="2" placeholder="Your name" />
  <input name="email" type="email" bind="$email" required="true" placeholder="you@domain.com" />
  <button type="submit">Join Waitlist</button>
</form>

<p id="status">$msg ($count joined)</p>

<rules>
  body:load {
    $ok: db-create($store, "users", "name, email");
    $count: db-count($store, "users");
  }

  #signup:submit {
    @if (valid-form("#signup")) {
      $count: db-insert($store, "users", trim($name), lower(trim($email)));
      $msg: concat("Welcome aboard, ", trim($name), "!");
      $name: "";
      $email: "";
    } @else {
      $msg: form-error("#signup");
    }
  }
</rules>
```

- **Zero external database install:** `<db id="store" src="./waitlist.hdb" />` writes atomically and safely to a local file.
- **SQL-injection proof:** Need to search? Use parameterized `sql($store, "SELECT * FROM users WHERE email = ?", $email)`.

---

<a id="chapter-13"></a>
## Chapter 13: Reusable Components & Built-In Tests (`<define>`, SRI & `<test>`)

### 1. Create Your Own HTML Tags (`<define>`)
Stop copy-pasting the same card or header across pages:

```html
<!-- card.htmp -->
<define tag="feature-card" title="Title" desc="Details">
  <article class="card">
    <h3>$title</h3>
    <p>$desc</p>
    <slot />
  </article>
</define>
```

Include it cleanly in any page and pin its cryptographic SHA-256 fingerprint with `honey hash ./card.htmp`:

```html
<link rel="include" href="./card.htmp" integrity="sha256-..." />
```

### 2. Built-In Plain-English Tests (`<test>`)
Prove your app works in **0 milliseconds** with declarative `<test>` blocks (automatically stripped from production builds):

```html
<test name="adds $50 when Earn is clicked">
  trigger: #earn-btn:click;
  assert: $cash == 550;
  assert-contains: #hud "550";
</test>
```

Run `honey test app.htmp` to verify, and `honey fmt app.htmp` to format your code cleanly.

---

<a id="chapter-14"></a>
## Chapter 14: One File, Four Targets (Web, Static, Gmail Email & `.exe`)

Install the single `honey` CLI in one line:
- **Windows (PowerShell):** `irm https://underlisted-x.com/honeyscript/downloads/install.ps1 | iex`
- **Linux (`x86_64`):** `curl -fsSL https://underlisted-x.com/honeyscript/downloads/install.sh | sh`

Then compile your `.htmp` file to **any target you need**:

```bash
# 1. Live Zero-JS Web App (works even with JavaScript turned OFF!)
honey serve app.htmp --port 8080 --watch

# 2. Static Zero-JS Website (0 bytes of JS, instant load)
honey build --web --zero-js site.htmp -o dist/index.html

# 3. Gmail, Apple Mail & Outlook HTML Email (inline-CSS <table>, 0 <script>)
honey build --email receipt.htmp -o receipt.html

# 4. Standalone Executable (zero Node/Python/Rust needed for end users)
honey build --exe app.htmp --serve -o my-app.exe
```

You learned **one clean foundation** — HTML5, CSS3, and HTML+ — and now you can build real websites, emails, APIs, databases, and desktop/server apps.

---

<a id="appendix"></a>
## Appendix: Complete HTML5, CSS3 & HTML+ Cheat Sheet

| Category | Syntax | What It Does |
| :--- | :--- | :--- |
| **HTML5 Structure** | `<h1>`, `<p>`, `<a>`, `<img>`, `<ul>`, `<li>`, `<header>`, `<main>`, `<footer>` | Semantic page structure & content |
| **HTML5 Labels** | `id="unique"` · `class="reusable"` | Names boxes for styling and rules |
| **HTML5 Forms** | `<form>`, `<input type="email" required minlength="2">`, `<button type="submit">` | Collects & validates user input |
| **CSS3 Box Model** | `box-sizing: border-box; padding: 16px; border: 1px solid #34e89e; margin: 12px;` | Controls inner & outer spacing cleanly |
| **CSS3 Layout** | `display: flex; gap: 12px;` · `display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));` | Modern responsive rows & card grids |
| **HTML+ State** | `<var cash="500" />` · `<const cap="50" />` · `<array items="A, B" />` | Typed reactive memory boxes (read with `$`) |
| **HTML+ Behavior** | `<rules> #btn:click { $cash: calc($cash + 50); } </rules>` | Reactive events, math & `@if`/`@else` |
| **HTML+ Lists/Bind** | `<input bind="$name" />` · `<each item="x" in="$items"><p>$x</p></each>` | Two-way binding & dynamic lists |
| **HTML+ Database** | `<db id="store" src="./app.hdb" />` + `db-create`, `db-insert`, `sql()` | Embedded crash-safe ACID database |
| **HTML+ Reuse** | `<define tag="my-card">` + `<link rel="include" href="..." integrity="sha256-..." />` | Scoped custom tags & SRI hash-pinned partials |
| **HTML+ Testing** | `<test name="...">trigger: #btn:click; assert: $x == 1;</test>` | Built-in 0 ms tests (`honey test`) |

### Keep Practicing
- **Live Zero-JS Dare:** [underlisted-x.com/honeyscript/showcases/zero-js-live/](https://underlisted-x.com/honeyscript/showcases/zero-js-live/)
- **7 Real Runnable Showcases:** [underlisted-x.com/honeyscript/showcases/](https://underlisted-x.com/honeyscript/showcases/)
- **Interactive 10-Lesson School:** [underlisted-x.com/honeyscript/school/](https://underlisted-x.com/honeyscript/school/)
- **Live Browser Sandbox:** [underlisted-x.com/honeyscript/sandbox/](https://underlisted-x.com/honeyscript/sandbox/)
