Customize this training

Get a certificate

Web Development Basics: HTML, CSS and JavaScript

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

  1. How the web works and the structure of a page
  2. Semantic HTML and accessibility basics
  3. CSS basics and layout with flexbox and grid
  4. Responsive design for phones, tablets and desktops
  5. JavaScript basics and the DOM
  6. Forms that people can fill in
  7. 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: behaviour

Each language has one job. Keep them in separate files when you can.

LanguageAnswers the questionExample
HTMLWhat is on the page?a heading, a paragraph, a form
CSSHow does it look?colours, spacing, columns
JavaScriptWhat 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.
Remember: the browser only understands HTML, CSS and JavaScript. Everything else on the server (PHP, Python, databases) must finally send these three to the browser.

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.

ElementUse 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.
Remember: the right element gives you keyboard support, focus and meaning for free. Rebuilding them by hand costs time and is often broken.

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"> .

SelectorTargetsExample
typeevery element of that kind p
classelements with .card
idthe one element with #top
descendantlinks inside nav nav a
statea 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 ▫️ margin

The 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.

  1. Viewport tag — without the meta viewport tag, phones show a zoomed-out desktop page
  2. One column by default — stacked blocks, full width, readable text (about 16px or 1rem minimum)
  3. Add a breakpoint where the design breaks — @media (min-width: 48rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
  4. Add more only if needed — for example three columns from 64rem
  5. 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.

UnitRelative toGood for
remroot font sizetext, spacing, breakpoints
%parent widthwidths of columns
vw / vhviewport width / heightfull-screen sections
pxfixedborders, small details
Remember: never disable zoom (user-scalable=no). People with low vision need to pinch to zoom, and WCAG requires text to resize up to 200% without losing content.

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.

ConceptShort exampleMeaning
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.

  1. Open the console — F12, Console tab: try lines of code and read error messages
  2. Read the error — it gives the file and line number, for example "x is not defined"
  3. Log values — console.log(total) shows what a variable really holds
  4. Fix one thing at a time — reload and test again
Remember: avoid var in new code: const and let are block-scoped and prevent many bugs. Prefer const, and switch to let only when the value must change.

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).

NeedElement 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 choicescheckboxes
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.
Remember: collecting personal data brings legal duties (GDPR in the EU, law 09-08 in Morocco, overseen by the CNDP): say why you collect it and do not ask for more than you need.

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.

  1. Check the site locally — all links relative, file names in lower case, no broken images
  2. Choose hosting — static hosting for HTML, CSS and JS only; shared or cloud hosting if you need PHP or a database
  3. Upload — by SFTP, by the host's file manager or by pushing to a Git repository that deploys automatically
  4. Point the domain — an A record (IP address) or CNAME record (another name) in the DNS zone; changes can take time to spread
  5. Turn on HTTPS — most hosts issue a free TLS certificate (for example from Let's Encrypt); redirect all HTTP to HTTPS
  6. Test the live site — phone and desktop, forms, 404 page, speed with Lighthouse
Before launchWhy
Unique title and meta description per pagesearch results and sharing
index.html in each folderthe server shows it for the folder address
A custom 404 pagelost visitors find their way back
A backup of the previous versionquick rollback if something breaks
Privacy notice and cookie consent if you track visitorsGDPR, Moroccan law 09-08
Remember: use version control (Git) even alone: every change is recorded, and you can go back to any working version in seconds.

The full lesson continues in the interactive course on this page.

Sources and references

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