Web Development Basics: HTML, CSS and JavaScript
Build a simple, accessible and responsive website: semantic HTML, CSS layout with flexbox and grid, JavaScript and the DOM, forms, publishing and security basics.
What you will learn
- Explain how a browser gets a page from a server and write a valid HTML document skeleton
- Choose semantic HTML elements and apply basic accessibility checks (alt text, contrast, keyboard, WCAG)
- Style pages with CSS selectors and the box model, and build layouts with flexbox and grid
- Make pages responsive with mobile-first CSS, media queries and flexible images
- Write basic JavaScript and update the DOM safely in response to events
- Build labelled, accessible forms and validate them in the browser and on the server
- Publish a site with a domain, hosting, DNS and HTTPS, and apply core web security habits
Modules
- How the web works and the structure of a page
- Semantic HTML and accessibility basics
- CSS basics and layout with flexbox and grid
- Responsive design for phones, tablets and desktops
- JavaScript basics and the DOM
- Forms that people can fill in
- Publishing a site and web security basics
Course facts
- Level
- Awareness
- Estimated study time
- about 45 minutes
- Final assessment
- 10 questions · Pass mark 80%
- Available in
- English, Français, العربية
- Access
- Free. Optional verifiable certificate
- Last updated
- Published by
- AMAADOR ACADEMY
Who this course is for
Workers, supervisors, managers and specialists whose responsibilities touch this subject.
Prerequisites
Site induction, task-specific competence and authorization remain mandatory where applicable.
Course content
1. How the web works and the structure of a page
When you type an address such as https://example.com, your browser asks a DNS server for the IP address of that name, then sends an HTTP request to the web server. The server answers with files. The browser reads them and draws the page.
🧱 HTML: structure 🎨 CSS: appearance ⚙️ JavaScript: behaviourEach language has one job. Keep them in separate files when you can.
| Language | Answers the question | Example |
|---|---|---|
| HTML | What is on the page? | a heading, a paragraph, a form |
| CSS | How does it look? | colours, spacing, columns |
| JavaScript | What happens when I act? | open a menu, check a form |
The S in HTTPS means the connection is encrypted with TLS. Every public site should use HTTPS today; browsers mark plain HTTP pages as "not secure".
What you need to start
- A text editor (for example the free Visual Studio Code).
- A modern browser with developer tools (press F12).
- A folder for your project, with an index.html file as the home page.
2. Semantic HTML and accessibility basics
Semantic HTML means using the element that describes what the content is, not how it looks. A <button> is a button; a <div> with a click handler only looks like one. Search engines, screen readers and keyboard users rely on this meaning.
| Element | Use it for |
|---|---|
| <header> / <footer> | top and bottom areas of the page or of a section |
| <nav> | the main navigation links |
| <main> | the unique main content (one per page) |
| <h1> to <h6> | headings in logical order: one h1, then h2, h3… |
| <article> / <section> | a self-contained item / a themed group with a heading |
| <ul> , <ol> | lists of items, unordered or in order |
| <a href> | links that go somewhere |
| <button> | actions on the page (open, send, close) |
Headings form the outline of the page. Screen reader users jump from heading to heading, so never pick h4 just because it is smaller: change the size in CSS instead.
Do
- Use one h1 that says what the page is about.
- Use a link to navigate and a button to act.
- Keep a div only for layout boxes with no meaning.
Don't
- Skip from h1 to h4.
- Build buttons from div or span.
- Use a table to place things side by side.
3. CSS basics and layout with flexbox and grid
A CSS rule has a selector and declarations: h1 { color: navy; font-size: 2rem; } . Put your rules in a separate file and link it in the head with <link rel="stylesheet" href="style.css"> .
| Selector | Targets | Example |
|---|---|---|
| type | every element of that kind | p |
| class | elements with | .card |
| id | the one element with | #top |
| descendant | links inside nav | nav a |
| state | a link under the mouse or keyboard focus | a:hover, a:focus |
When several rules hit the same element, the cascade decides: more specific selectors win (id beats class beats type), and if they are equal the later rule wins. Prefer classes: they are reusable and easy to override.
🟦 content ⬜ padding ⬛ border ▫️ marginThe box model: every element is a box, from the inside out.
By default, width applies to the content only, so padding and border make the box wider than you planned. Most developers start every stylesheet with *, *::before, *::after { box-sizing: border-box; } so width includes padding and border.
Remember: use the browser developer tools (right-click, Inspect) to see which rule wins and the size of each part of the box. It is the fastest way to debug CSS.4. Responsive design for phones, tablets and desktops
A responsive page adapts to the width of the screen. Many visitors arrive on a phone, so most teams work mobile first: write the simple one-column layout first, then add rules for wider screens.
- Viewport tag — without the meta viewport tag, phones show a zoomed-out desktop page
- One column by default — stacked blocks, full width, readable text (about 16px or 1rem minimum)
- Add a breakpoint where the design breaks — @media (min-width: 48rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
- Add more only if needed — for example three columns from 64rem
- Test — developer tools device mode, then a real phone
Choose breakpoints from your content, not from a list of devices: widen the window slowly and add a rule where lines become too long or items too cramped. Using rem in media queries respects the user's font settings.
| Unit | Relative to | Good for |
|---|---|---|
| rem | root font size | text, spacing, breakpoints |
| % | parent width | widths of columns |
| vw / vh | viewport width / height | full-screen sections |
| px | fixed | borders, small details |
5. JavaScript basics and the DOM
JavaScript adds behaviour to a page. Load your script at the end of the body, or in the head with <script src="app.js" defer></script> so it runs after the HTML is read.
| Concept | Short example | Meaning |
|---|---|---|
| constant | const rate = 0.2; | a value that is not reassigned (use by default) |
| variable | let count = 0; | a value that will change |
| string, number, boolean | "Rabat" , 42 , true | the basic types |
| array | const days = ["Mon", "Tue"]; | an ordered list; days[0] is "Mon" |
| object | const user = { name: "Amina", age: 30 }; | named properties; user.name |
| condition | if (age >= 18) { … } else { … } | run code only when a test is true |
| function | function total(a, b) { return a + b; } | reusable block that returns a result |
Use === (strict equality) rather than == : "5" == 5 is true because JavaScript converts types, while "5" === 5 is false. Values read from a form are always strings, so convert them with Number(value) before adding.
- Open the console — F12, Console tab: try lines of code and read error messages
- Read the error — it gives the file and line number, for example "x is not defined"
- Log values — console.log(total) shows what a variable really holds
- Fix one thing at a time — reload and test again
6. Forms that people can fill in
A form collects data and sends it to a server. The <form> element has an action (the address that receives the data) and a method : GET puts the data in the URL (fine for a search), POST sends it in the request body (use it for anything personal or that changes data).
| Need | Element or type |
|---|---|
| Name, short text | <input type="text"> |
| Email address | <input type="email"> (phone keyboards show @) |
| Phone number | <input type="tel"> |
| Date | <input type="date"> |
| Long message | <textarea> |
| One choice from a list | <select> or radio buttons |
| Several choices | checkboxes |
| Send | <button type="submit"> |
Every field needs a label linked to it: <label for="email">Email</label> then <input name="email" type="email"> . Clicking the label focuses the field, and screen readers announce it. The name attribute is the key the server receives.
Do
- Keep the label visible above the field.
- Group related radios with fieldset and legend.
- Use autocomplete values such as autocomplete="email".
- Ask only for the data you need.
Don't
- Use placeholder text as the only label: it disappears when typing.
- Show errors by colour alone.
- Reset the whole form after one error.
7. Publishing a site and web security basics
To publish a site you need three things: a domain name (bought from a registrar), hosting (a server that stores your files) and DNS records that point the name to the server.
- Check the site locally — all links relative, file names in lower case, no broken images
- Choose hosting — static hosting for HTML, CSS and JS only; shared or cloud hosting if you need PHP or a database
- Upload — by SFTP, by the host's file manager or by pushing to a Git repository that deploys automatically
- Point the domain — an A record (IP address) or CNAME record (another name) in the DNS zone; changes can take time to spread
- Turn on HTTPS — most hosts issue a free TLS certificate (for example from Let's Encrypt); redirect all HTTP to HTTPS
- Test the live site — phone and desktop, forms, 404 page, speed with Lighthouse
| Before launch | Why |
|---|---|
| Unique title and meta description per page | search results and sharing |
| index.html in each folder | the server shows it for the folder address |
| A custom 404 page | lost visitors find their way back |
| A backup of the previous version | quick rollback if something breaks |
| Privacy notice and cookie consent if you track visitors | GDPR, Moroccan law 09-08 |
The full lesson continues in the interactive course on this page.
Sources and references
- Learn web development — MDN Web Docs (Mozilla)
- HTML Living Standard — WHATWG
- Web Content Accessibility Guidelines (WCAG) 2.2 — W3C
- Web Accessibility Initiative: introduction to web accessibility — W3C WAI
- OWASP Top 10 — OWASP Foundation
- Markup Validation Service — W3C
- British Airways penalty notice (2020) — UK Information Commissioner's Office
Introductory course for learning purposes. It is not a professional certification and does not make a site legally compliant: check accessibility, data protection and security duties (for example WCAG, GDPR, Moroccan law 09-08) with a qualified professional for production systems.
All courses · Data Engineering & Analytics — Free certified training