Tutoriel HTML
Learn HTML from zero to professional. A live editor in every lesson, quizzes and real projects.
Getting Started
- Qu'est-ce que HTML ? A beginner-friendly introduction to HTML. Learn what HTML does, how browsers read it, and write your very first lines of markup.
- Une brève histoire de HTML How HTML grew from a short list of tags at CERN into today's Living Standard, what "HTML5" really means, and why every page still starts with a doctype.
- Votre première page web Set up a code editor, save your first .html file and open it in a browser. Learn the basic skeleton that every HTML document starts with.
- Afficher le code source et utiliser les DevTools Learn the difference between a page's source and its live DOM, inspect and edit elements in DevTools, use the console, test mobile sizes and spot repaired HTML.
- Éléments et balises Understand the difference between tags and elements, how to nest elements correctly, and which special elements never need a closing tag.
- Les attributs Learn how attributes add extra information to HTML elements. Build links with href, show images with src and alt, and use global attributes like id, class, title and lang.
- Titres et paragraphes Structure your text with the six heading levels, paragraphs, line breaks and thematic breaks, and learn why a logical heading outline matters for readers and search engines.
- Éditeurs HTML, Emmet et commentaires Pick a code editor for HTML, type faster with Emmet abbreviations, and learn how HTML comments work, what they are good for and what never to put in them.
Text Content
- Mettre en forme le texte Format text by meaning, not looks. Learn strong vs b, em vs i, plus u, s, mark, small, sub, sup, ins and del, with clear rules for when to use each one.
- Citations, références et abréviations Quote and credit other people's words with blockquote, q and cite, explain abbreviations and terms with abbr and dfn, and handle contact details and text direction.
- Code, saisie clavier et sortie de programme Mark up code snippets, keyboard shortcuts, program output and variables with code, pre, kbd, samp and var, and learn to escape < and & inside code samples.
- Entités HTML Learn when you need HTML entities, how named, decimal and hex references work, how to use no-break spaces and soft hyphens, plus a table of common ones.
- Symboles et emojis Add math signs, arrows, currency symbols, Greek letters and emoji to your pages with Unicode, and make sure they display everywhere and work with screen readers.
- Encodage des caractères et UTF-8 Understand bytes vs characters, ASCII, Windows-1252, Unicode and UTF-8, where to put meta charset, and how to diagnose and fix garbled text known as mojibake.
- Dates, valeurs de données et texte ruby Give dates, times and numbers a machine-readable form with time and data, control line breaks in long words with wbr, and annotate East Asian text with ruby.
Links and Navigation
- Les liens en profondeur Master the HTML a element. Learn the kinds of href values, how to write link text people can trust, image links, the title attribute and when to use a button.
- Chemins de fichiers et URL Learn how URLs are built and how browsers resolve relative paths like ./ and ../, root-relative paths and absolute URLs, with folder examples and the base element.
- Cibles de lien et sauts dans la page Control where links open with target, keep new tabs safe with rel="noopener noreferrer", and jump to exact sections with fragment links, :target and back-to-top links.
- Liens e-mail, téléphone et téléchargement Create email links with subject and body, phone and SMS links, and download links. Learn hreflang, type and the rel values nofollow, sponsored and ugc.
- Créer des menus de navigation Build accessible navigation with the nav element and lists. Mark the current page with aria-current, and add breadcrumbs, skip links, pagination and footer links.
- Encodage des URL Learn why URLs need percent-encoding, which characters are reserved, %20 versus + for spaces, how UTF-8 encodes non-English text, and how encodeURIComponent works.
Lists
- Les listes Learn how to build bulleted and numbered lists with ul, ol and li, how to choose the right one, and how to change bullets and numbers with list-style-type.
- Options des listes ordonnées Control numbering in HTML ordered lists. Start at any number, count down with reversed, choose letters or Roman numerals with type, and set item numbers with value.
- Listes de description Use dl, dt and dd to build glossaries, FAQs and key-value details. Learn how to group several terms and descriptions, wrap groups in div and style them.
- Listes imbriquées Learn how to nest HTML lists correctly inside li elements, build outlines, mix ordered and unordered lists, number items 1.1 and 1.2, and avoid common mistakes.
Tables
- Tableaux Build your first HTML tables with table, tr, td and th. Learn how rows and cells form a grid, when a table is the right choice, and why tables are never for layout.
- En-têtes, sections et légendes de tableau Give your tables real structure with th and scope, a caption that names the table, and thead, tbody and tfoot row groups for headers, data and totals.
- Fusionner des lignes et des colonnes Merge table cells with colspan and rowspan. Learn to plan the grid on paper first, count cells correctly, and avoid the overlapping cells that break table layouts.
- Groupes de colonnes Use colgroup and col to describe and style whole table columns. Learn the span attribute, where column groups go, and the four CSS properties that work on columns.
- Mettre en forme les tableaux avec CSS Turn plain HTML tables into clear, readable data with CSS. Borders and border-collapse, padding, alignment, zebra rows, hover, sticky headers and scrolling on small screens.
- Tableaux accessibles Make data tables work for screen-reader users. Connect cells to headers with scope and the headers attribute, describe tables well, and avoid nested and layout tables.
Images and Media
- Les images Add images with the HTML img element. Write useful alt text, set width and height to stop layout shift, pick the right format and lazy-load images.
- Images responsives Serve the right image to every screen with srcset, sizes and the picture element. Learn w and x descriptors, format fallbacks and art direction.
- Images d'arrière-plan dans les pages HTML Add background images with CSS, control size, position and repeat, layer gradients for readable text, and learn when to use img instead of a background.
- Figures et légendes Use figure and figcaption to caption images, code samples, quotes and charts. Learn when content is a figure and how alt text and captions differ.
- Les cartes d'image Make parts of one image clickable with map and area. Learn rect, circle and poly coordinates, accessible alt text, and a responsive SVG alternative.
- Favicons et icônes d'application Add a favicon with link rel="icon", use SVG and dark-mode icons, and set up apple-touch-icon and a web app manifest. A minimal, modern set of icon files.
- Vidéo Embed video with the HTML video element. Use controls, multiple sources, a poster image, autoplay rules, muted, loop, playsinline, preload and sizing.
- Audio Play sound with the HTML audio element. Add controls, offer MP3 and Ogg sources, understand autoplay rules, loop and mute, and start audio from JavaScript.
- Sous-titres et légendes Add captions and subtitles to video with the track element and WebVTT files. Learn kind, srclang, label and default, cue timing, settings and styling.
- Les iframes Embed one web page inside another with the HTML iframe element. Learn src, srcdoc, title, sandbox, allow, loading="lazy", referrerpolicy and framing rules.
- Intégrer des vidéos, des cartes et d'autres contenus Embed videos, maps and other third-party content with iframes. Make embeds responsive, protect privacy, and see where embed and object fit today.
Page Structure and Layout
- Éléments de bloc et éléments en ligne Learn the difference between block and inline elements, how they flow on the page, which elements can nest inside which, and when inline-block is the right choice.
- Div et span Learn what div and span do, how they group content for CSS and JavaScript, and when a semantic element like section, nav or button is the better choice.
- Les classes Use the class attribute to group elements for CSS and JavaScript. Learn multiple classes, class selectors, classList methods and naming conventions that scale.
- Les id Give elements unique ids for page jumps, form labels and JavaScript. Learn the rules for valid ids, why to be careful with id selectors in CSS, and getElementById.
- Éléments sémantiques Learn the HTML semantic elements header, nav, main, article, section, aside, footer, hgroup and search, and how they create landmarks for assistive tech.
- Mise en page Build a complete page layout from semantic HTML elements, then arrange it with CSS Flexbox and Grid, including a footer that sticks to the bottom.
- Responsive Web Design Make pages that work on every screen. Learn the viewport meta tag, fluid widths, flexible images, media queries, mobile-first CSS and fluid type with clamp().
The Head, Metadata and SEO
- L'élément head Learn what belongs in the HTML head element (title, meta, link, style, script, base and noscript) and the order that helps pages load fast and read well.
- Titres de page et descriptions Write page titles and meta descriptions that work for people and search results. Learn about length, uniqueness, branding and how search engines use them.
- Balises meta A practical guide to HTML meta tags: charset, viewport, description, robots, theme-color, color-scheme, referrer and http-equiv, plus the old tags you can drop.
- Aperçus de partage sur les réseaux sociaux Control how your pages look when shared on social networks and chat apps with Open Graph and X card tags. Learn image sizes, fallbacks and how to test.
- Données structurées Describe your pages to machines with schema.org structured data. Write JSON-LD and microdata, learn about rich results, and validate your markup.
- Charger efficacement les ressources Speed up your pages from the HTML head. Learn render-blocking resources, defer and async, preconnect, preload, modulepreload, prefetch and fetchpriority.
- Liste de contrôle SEO pour HTML A practical HTML SEO checklist: titles, headings, canonical URLs, robots rules, hreflang, links, images and sitemaps, with a script that audits a page.
CSS and JavaScript in HTML
- L'attribut style Learn the HTML style attribute and CSS declaration syntax, try common properties for text, color, spacing and borders, and see when inline styles are the wrong tool.
- Couleurs Write colors with names, hex codes, rgb() and hsl(), add transparency with alpha, reuse colors with currentColor and check text contrast for readability.
- Ajouter du CSS au HTML Compare the three ways to add CSS to HTML (inline, the style element and external stylesheets), see how the cascade picks a winner and load CSS per media type.
- Ajouter du JavaScript Add JavaScript to HTML with inline and external script elements, choose where to place them, compare defer, async and type="module", and use noscript fallbacks.
- Attributs d'événement et écouteurs d'événements Respond to clicks, typing and other events with HTML event attributes like onclick, learn why addEventListener is better, and use the event object.
- Le Document Object Model Learn how the browser turns HTML into the DOM tree, find elements with querySelector, change text safely, create elements and work with attributes and classList.
Forms
- Formulaires Learn how HTML forms collect input, how the browser turns fields into name=value pairs, when to use GET or POST, and how to handle submit in JavaScript.
- Types d'input A guided tour of every HTML input type, from text, email and number to date, color, file and range, with what each one does on desktop and mobile.
- Labels, fieldsets et legends Give every form control a proper name with label, group related fields with fieldset and legend, and learn how browsers work out a control's accessible name.
- Cases à cocher et boutons radio Learn how checkboxes and radio buttons submit their values, how to build groups, how to make a choice required, and how to restyle them with accent-color.
- Listes déroulantes et suggestions Build drop-down menus with select, option and optgroup, allow multiple choices, add a required placeholder option, and offer typing suggestions with datalist.
- Zones de texte et boutons Collect longer text with textarea (rows, cols, maxlength, wrap) and master buttons, including submit, reset and button types, button vs input, and formaction.
- Les attributs de input Fine-tune form inputs with value, placeholder, readonly, disabled, min, max, step, pattern, autocomplete, inputmode, enterkeyhint and other input attributes.
- Attributs de formulaire Configure the form element itself with action, method, target, enctype for file uploads, autocomplete, novalidate, name and accept-charset.
- Validation de formulaire Let the browser check input with required, type, min, max, pattern and length, style errors with :user-invalid, and add custom rules with the validation API.
- Output, meter et progress Show calculated results with output, measurements within a known range with meter, and task completion with progress, including indeterminate progress bars.
Interactive Elements
- Sections repliables avec details Build collapsible sections and accordions with details and summary, open them by default, group them with name, react to the toggle event and style the marker.
- Boîtes de dialogue et modales Build accessible modal and non-modal dialogs with the dialog element, showModal and close, method="dialog" forms, returnValue, ::backdrop and focus handling.
- Popovers Use the popover attribute to build menus, info panels and notifications. Learn auto vs manual popovers, popovertarget, toggle events and when to use dialog.
- Attributs globaux Learn the HTML global attributes that work on every element, from id, class and lang to hidden, inert, contenteditable, tabindex, dir and translate.
- Attributs de données personnalisés Store your own data on HTML elements with data-* attributes, read and write it through JavaScript's dataset, and style elements with CSS attribute selectors.
- Templates et Web Components Reuse markup with the template element, then build your own HTML tags with custom elements, encapsulate styles with shadow DOM and fill them using slots.
- Contenu modifiable : contenteditable, spellcheck et inputmode Make any element editable with contenteditable, control spell checking, and pick the right mobile keyboard with inputmode, enterkeyhint and autocapitalize.
Graphics
- Bases de SVG Draw sharp, scalable graphics with inline SVG. Learn the coordinate system and viewBox, the basic shapes, fill and stroke, and when to use img instead.
- Tracés, texte et dégradés SVG Draw any shape with SVG path commands, add real text, fill shapes with linear and radial gradients, reuse parts with g and use, and make SVG accessible.
- Découpes, masques, filtres et animation SVG Cut shapes with clipPath, fade them with masks, blur, tint and distort them with SVG filter primitives, and animate SVG with SMIL elements or CSS animations.
- Les bases de canvas Get started with the HTML canvas element. Draw rectangles with the 2D context, set fill and stroke styles, size the canvas sharply and provide fallback content.
- Dessiner et animer avec canvas Go beyond rectangles on the HTML canvas. Draw paths and arcs, write text, place images with drawImage, paint gradients and animate with requestAnimationFrame.
- Les mathématiques avec MathML Write mathematical formulas directly in HTML with MathML. Learn the math element, mi, mn, mo, mrow, fractions, powers, roots, display math and browser support.
Web APIs
- Introduction aux Web APIs Learn what browser Web APIs are, how to detect whether a feature exists, how permission prompts and secure contexts work, and how to read promise-based code.
- Géolocalisation Get the user's location with the Geolocation API. Learn getCurrentPosition, watchPosition, the options object, every error code, permissions and HTTPS.
- Glisser-déposer Build drag and drop with HTML and JavaScript. Learn the draggable attribute, the drag events, dataTransfer, drop zones and how to accept dropped files.
- Fichiers, envoi de fichiers et API FileReader Let users pick files with input type=file, read them with File, Blob and FileReader, preview images with object URLs and send uploads with FormData.
- Web Storage Save data in the browser with localStorage and sessionStorage. Learn the API, storing objects as JSON, the storage event, size limits and privacy rules.
- Web Workers Keep your page responsive with Web Workers. Learn how to start a worker, exchange messages with postMessage, handle errors and stop a worker with terminate.
- Observers : Intersection, Resize et Mutation Watch elements without polling: IntersectionObserver for lazy reveal and sticky detection, ResizeObserver for size changes, MutationObserver for DOM edits.
- Les API History, Location et URL Read and change the address bar from JavaScript. Learn the URL and URLSearchParams classes, the location object, pushState and popstate, and hash-based routing.
- Server-Sent Events Stream live updates from a server with Server-Sent Events. Learn EventSource, the text/event-stream format, named events, IDs and automatic reconnection.
- WebSockets Learn the WebSocket API for two-way, real-time messaging. Open a connection, send and receive data, handle close codes, and choose between WebSockets, SSE and fetch.
- IndexedDB Store large amounts of structured data in the browser with IndexedDB. Learn databases, versions, object stores, transactions, indexes, cursors and key ranges.
- Messagerie entre documents avec postMessage Send data between a page and its iframes or popups with window.postMessage. Learn targetOrigin, event.origin checks, structured cloning and MessageChannel.
- Requêtes inter-origines et CORS Understand the same-origin policy and CORS. Learn simple and preflighted requests, credentials, opaque responses, the crossorigin attribute and how to read CORS errors.
- Progressive Web Apps : manifeste et service workers Turn a website into an installable app. Write a web app manifest, register a service worker, cache files for offline use and pick a caching strategy.
- Les API Web Share, Clipboard et Notifications Share content through the system share sheet, copy and paste with the async Clipboard API, and ask for Notification permission the right way, with fallbacks.
- Page Visibility, plein écran et Screen Wake Lock React when a tab is hidden with the Page Visibility API, take over the screen with the Fullscreen API, and keep a device awake with Screen Wake Lock.
- Caméra, microphone et MediaRecorder Capture live video and audio with getUserMedia, handle permissions and errors, record streams with MediaRecorder, and play back or download the result.
- Les bases de la Web Audio API Generate and shape sound with AudioContext, oscillators, gain nodes and filters. Build a small synthesizer and draw its waveform with an analyser.
- Synthèse vocale et reconnaissance vocale Make the browser speak with speechSynthesis and listen with SpeechRecognition. Pick voices, control rate and pitch, handle events, and design for privacy.
Accessibility and Best Practices
- Les bases de l'accessibilité Learn who accessibility helps, how screen readers read your HTML, and the habits that matter most, from semantic elements and alt text to labels and contrast.
- Rôles, états et propriétés ARIA Learn when ARIA helps and when it hurts. Use roles, accessible names, descriptions, aria-expanded and live regions correctly, following the first rule of ARIA.
- Accès au clavier et focus Make every control reachable without a mouse. Learn tab order, tabindex 0 and -1, visible focus with :focus-visible, skip links, inert and focus management.
- Guide de style HTML Write HTML that is easy to read and maintain, with conventions for the doctype, lowercase names, quoting, indentation, optional tags, file names and comments.
- Valider votre HTML Check your markup with the W3C Nu HTML Checker and editor linters, fix the most common validation errors, and see how browsers quietly repair broken HTML.
- HTML et XHTML Learn how HTML and XHTML differ, the strict rules of the XML syntax, why the MIME type decides how a page is parsed, and old versus modern doctypes.
- Fonctionnalités dépréciées et obsolètes Recognize obsolete HTML such as font, center, big, tt, acronym, frames, marquee and presentational attributes, and learn their modern replacements.
- HTML à chargement rapide Make pages load fast with lean HTML, image dimensions, lazy loading, non-blocking scripts, a smaller DOM, compression and caching, measured by Core Web Vitals.
- Sécurité HTML : CSP, sandbox et Subresource Integrity Harden your pages with HTML features: a Content-Security-Policy meta tag, the iframe sandbox attribute, Subresource Integrity hashes and rel=noopener on links.
- Les bases du HTML pour e-mails Learn how HTML email differs from web pages. Build table-based layouts, use inline styles, make bulletproof buttons and plan for the limits of email clients.
Projects
- Projet : page de profil personnel Build a complete personal profile page with HTML and a little CSS. Add a photo, an introduction, skill lists, quick facts, contact links and a footer, step by step.
- Projet : article de blog Mark up a complete blog post with semantic HTML. Use article, header, time, a table of contents, figure, blockquote, aside and footer, then lay it out with CSS.
- Projet : formulaire de contact accessible Build an accessible contact form step by step with labels, fieldsets, hints, validation and clear error messages, plus a submit handler that shows the data.
- Projet : page d'atterrissage adaptative Build a complete responsive landing page with semantic HTML and CSS. Create a header, hero, features grid, pricing table, FAQ accordion, footer and media queries.
- Projet : page d'événement Build a complete event page in HTML with machine-readable dates, a schedule table, speaker cards, a static venue map and an accessible registration form.
Practice and Review
- Aide-mémoire HTML A one-page HTML cheat sheet covering the document skeleton, text, links, lists, images, media, tables, forms, interactive elements and the head, with live examples.
- Exercices pratiques HTML Practice HTML with 26 graded exercises, from headings and links to tables, forms, dialogs and accessibility fixes. Each has a live starter editor and a solution.
- Questions d'entretien HTML Prepare for front-end interviews with 36 HTML questions and clear answers, grouped by level, covering semantics, forms, media, accessibility, performance and security.