Chapter 1 – What Is Code?
Code is a set of instructions you give a computer so it can do something useful:
display a web page, calculate a result, store data, or respond to a button click.
You write these instructions in programming languages like HTML,
CSS, JavaScript, Python, and many others.
At its core, learning to code is learning how to break problems into small, clear steps that a computer can follow. You don’t need to be a “math genius”— you need patience, curiosity, and a willingness to experiment.
Chapter 2 – Your First Tools
Text editor
To write code, you need a text editor. You can start with something simple like Notepad (Windows) or TextEdit (macOS in plain text mode), or install a dedicated editor like VS Code, Sublime Text, or Atom.
Web browser
For web development, your browser (Chrome, Edge, Firefox, Safari) is where you
see your code come to life. You’ll open your .html files in the
browser to test and refine your work.
Creating your first file
Try this:
- Create a new file: Save it as
hello.html. - Paste this code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>You just wrote your first web page.</p>
</body>
</html>
- Open it in your browser: double-click the file.
<h1> and
<p>, save the file, and refresh the browser. Notice how the
page updates.
Chapter 3 – Thinking Like a Programmer
Breaking problems into steps
Programmers rarely solve big problems in one leap. Instead, they break them into smaller steps. For example: “Build a website” becomes “create a page,” “add a title,” “add navigation,” “add content,” and so on.
Inputs, processing, outputs
Many programs follow a simple pattern: they take input, do some processing, and produce an output. A calculator app takes numbers (input), performs math (processing), and shows the result (output).
Chapter 4 – HTML Basics
HTML (HyperText Markup Language) is the structure of a web page. It uses elements like headings, paragraphs, links, and images to describe what appears on the page.
Elements and tags
Most HTML elements have an opening tag and a closing tag:
<p>This is a paragraph.</p>.
Common elements
<h1>to<h6>– headings<p>– paragraph<a>– link<img>– image<ul>,<ol>,<li>– lists
<h1>My First Page</h1>
<p>I am learning HTML.</p>
<a href="https://example.com">Visit a site</a>
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
Chapter 5 – CSS Basics
CSS (Cascading Style Sheets) controls how your page looks: colors, fonts, spacing, layout, and more.
Inline vs. internal styles
You can write CSS inside a <style> tag in your HTML file, or
in a separate .css file. Here’s an internal example:
<style>
body {
font-family: Arial, sans-serif;
background: #f7f7f7;
}
h1 {
color: #1d4ed8;
}
</style>
Selectors and properties
A CSS rule has a selector (what to style) and
properties (how to style it). For example:
p { color: #333; } means “make all paragraphs dark gray.”
Chapter 6 – JavaScript Basics
JavaScript adds behavior to your page. It lets you respond to clicks, change content, and build interactive experiences.
Your first script
<button id="hello-btn">Click me</button>
<p id="message"></p>
<script>
const button = document.getElementById("hello-btn");
const message = document.getElementById("message");
button.addEventListener("click", () => {
message.textContent = "You just ran JavaScript!";
});
</script>
Here, JavaScript “listens” for a click on the button and then changes the text of the paragraph.
Chapter 7 – Practice Projects
Small projects help you connect concepts and build confidence. Try:
- Personal homepage: A simple page with your name, a photo, and a short bio.
- Favorite links list: A list of your favorite websites with short descriptions.
- Quote generator: A button that shows a different quote each time you click.
Chapter 8 – How to Keep Going
Learning to code is a long-term practice, not a one-time event. You’ll forget things, get stuck, and then suddenly something will click. That’s normal.
- Practice regularly: Even 20–30 minutes a day adds up.
- Build tiny things: Don’t wait for a “big idea.” Make small, useful pages.
- Read other people’s code: Open examples, tweak them, and see what happens.
- Keep a learning log: Write down what you tried, what broke, and what you fixed.