Web development basics — HTML, CSS and JavaScript
Build your first web page from scratch: structure with HTML, style with CSS and make it interactive with JavaScript.
The three languages of the web
| Language | Job | Think of it as |
|---|---|---|
| HTML | the content and structure | the skeleton |
| CSS | colours, fonts, layout | the clothes |
| JavaScript | actions and logic | the muscles |
All you need is a text editor (VS Code is free) and a browser. Save a file as index.html and double-click it.
1. Your first HTML page
Definition: HTML (HyperText Markup Language) is the standard markup language that defines the structure and content of web pages using elements written as tags.
How it works: The browser parses HTML into the DOM (Document Object Model), a tree of elements. Semantic tags (header, nav, main, article, footer) describe meaning, which helps accessibility and SEO.
Example: <h1> marks the main heading, <a href> a link, <img> an image.
🧒 In simple words
<!doctype html>
<html>
<head>
<title>My first page</title>
</head>
<body>
<h1>Hi, I'm Asha</h1>
<p>I am learning web development.</p>
<a href="https://maniajobs.com">See jobs</a>
</body>
</html>The browser shows a big heading "Hi, I'm Asha", a line of text and a link "See jobs".
Tags come in pairs: <p> opens, </p> closes.
Tags you will use every day
| Tag | Use |
|---|---|
| h1 … h6 | headings |
| p | paragraph |
| a | link |
| img | picture (<img src="me.jpg" alt="My photo">) |
| ul / li | bullet list |
| div / section | containers to group things |
| form / input / button | forms |
2. Style it with CSS
Definition: CSS (Cascading Style Sheets) is the language that describes how HTML elements are presented — colours, fonts, spacing and layout.
How it works: Rules have a selector and declarations. When rules conflict, the cascade decides using importance, specificity (id > class > element) and source order. Layout systems: the box model, Flexbox (1-D) and Grid (2-D); media queries make designs responsive.
Example: .card { padding: 16px; border-radius: 12px; } styles every element with class card.
🧒 In simple words
Add this inside <head>:
<style>
body { font-family: Arial, sans-serif; max-width: 700px; margin: 40px auto; }
h1 { color: #4f46e5; }
.card { padding: 16px; border-radius: 12px; background: #f3f4f6; }
</style>A selector (h1, .card) picks elements; inside the braces you set properties.
Layout with flexbox
.row { display: flex; gap: 12px; justify-content: space-between; }Flexbox puts children side by side. Add flex-wrap: wrap so they stack on phones.
3. Make it interactive with JavaScript
Definition: JavaScript is a high-level, dynamically typed programming language that runs in browsers (and on servers with Node.js) to make web pages interactive.
How it works: It manipulates the DOM, responds to events (clicks, input), and talks to servers with fetch. It is single-threaded with an event loop that handles asynchronous work via callbacks, promises and async/await.
Example: A click on "Add to cart" updates the cart count without reloading the page.
🧒 In simple words
<button id="btn">Click me</button>
<p id="out"></p>
<script>
let clicks = 0;
document.getElementById("btn").addEventListener("click", () => {
clicks++;
document.getElementById("out").textContent = "Clicked " + clicks + " times";
});
</script>(after 3 clicks) Clicked 3 times
JavaScript basics
let/constmake variables.if (x > 5) { … } else { … }decides.for (let i = 0; i < 5; i++) { … }repeats.function add(a, b) { return a + b; }reuses code.document.querySelector(".card")finds an element on the page.
4. Mini project: a to-do list (30 minutes)
- HTML: an input, an "Add" button and an empty
<ul>. - JS: on click, read the input, create an
<li>, add it to the list, clear the input. - Bonus: click an item to mark it done (toggle a CSS class).
- Bonus 2: save the list in
localStorageso it stays after refresh.
5. Put it online for free
Create a GitHub account → upload your files → turn on GitHub Pages (Settings → Pages). You get a link you can put on your resume.
What to learn next
Responsive design → JavaScript fetch & APIs → a framework (React) → a backend (Node.js or Python) → databases (our SQL tutorial).