Web foundations
Learn it by doing it.
Build HTML semantics, CSS layouts, accessible forms, and readable JavaScript patterns in topic-specific exercises.
Complete the exercise. Explain the result. Apply the pattern.
Your course map stays open. Learn in order or jump to the problem you have.
Your course map
Each course builds on the last. Every lesson has a working example, a practice task, and feedback.
Find a specific skill
- 01HTML basics: Document shellThe doctype selects standards mode; html contains metadata in head and visible content in body.Practice
- 02HTML basics: Page title and languageA descriptive title names the browser tab; the lang attribute identifies the language of the document.Practice
- 03HTML basics: Heading hierarchyHeading levels describe nested sections, not a choice of font size.Practice
- 04HTML basics: Readable paragraphsA paragraph groups related sentences. Separate ideas deserve separate p elements rather than repeated line breaks.Practice
- 05HTML basics: Ordered task listsUse ol when the order of steps changes the meaning of the task.Practice
- 06HTML basics: Unordered feature listsUse ul for a set whose items have no required sequence.Practice
- 07HTML basics: Description listsA description list connects terms in dt to explanations in dd.Practice
- 08HTML basics: Emphasis and importanceem conveys stress emphasis; strong conveys importance, seriousness, or urgency. Neither is a generic styling hook.Practice
- 09HTML basics: Quoted contentblockquote identifies an extended quotation; cite names a work, not merely a person.Practice
- 10HTML basics: Dates and machine-readable timetime can display a friendly label while datetime supplies an unambiguous machine-readable date.Practice
- 11HTML basics: Data attributesdata-* attributes store page-specific information without pretending that it is visible text or a standard HTML behavior.Practice
- 12HTML basics: Reusable class namesClasses let multiple elements share presentation. IDs should identify a single element within a document.Practice
- 13Semantic structure: Site headerA top-level header introduces the page or site. It is not a replacement for the main content landmark.Practice
- 14Semantic structure: Primary navigationA nav landmark groups major navigation links; a label distinguishes it from another navigation region.Practice
- 15Semantic structure: Main landmarkThe main landmark contains the page-specific content, excluding repeated site navigation.Practice
- 16Semantic structure: Named sectionsA section groups a distinct topic. aria-labelledby can give the region its name from a visible heading.Practice
- 17Semantic structure: Independent articlesAn article is a self-contained composition that could make sense when distributed independently.Practice
- 18Semantic structure: Supporting asidesAn aside contains related but secondary material. Essential task instructions belong in the main flow.Practice
- 19Semantic structure: Page footerA footer contains information about its nearest section or the page, such as related links or authorship.Practice
- 20Semantic structure: Contact informationaddress marks contact information for its nearest article or body, not every postal address mentioned in text.Practice
- 21Semantic structure: Nested heading orderHeading order follows the relationship between topics. A subsection of h2 normally starts at h3.Practice
- 22Semantic structure: Complete page outlineA clear page outline separates site navigation, the primary task, and supporting information.Practice
- 23Links and media: Relative navigation linksA root-relative href resolves from the site root; a fragment targets an element in the same document.Practice
- 24Links and media: Descriptive link textA link should communicate its destination without requiring the reader to guess from nearby sentences.Practice
- 25Links and media: Current-page navigationaria-current="page" identifies the active page within navigation without making the link disappear.Practice
- 26Links and media: Images with useful alt textAlternative text communicates the relevant content of an informative image. Purely decorative images use empty alt text.Practice
- 27Links and media: Figures and captionsfigure groups a self-contained image with a figcaption that provides visible context.Practice
- 28Links and media: Responsive image dimensionsIntrinsic width and height let the browser reserve the image aspect ratio before loading the asset.Practice
- 29Links and media: Downloadable resourcesThe download attribute suggests downloading a same-origin resource; meaningful text still identifies the file.Practice
- 30Links and media: Media fallback copyMedia needs usable alternatives. A transcript link provides access to spoken information beyond player controls.Practice
- 31CSS basics: Element selectorsAn element selector applies declarations to every matching element in its scope.Practice
- 32CSS basics: Class selectorsA class selector targets an intentional reusable hook rather than every element of a type.Practice
- 33CSS basics: Color tokensCustom properties centralize reusable values; var() reads a token and can provide a fallback.Practice
- 34CSS basics: Readable typographyFont size, line height, and line length work together. Line height without a unit scales with the text.Practice
- 35CSS basics: Spacing with paddingPadding creates space inside the border; it does not separate the element from its neighbors.Practice
- 36CSS basics: Spacing with marginMargin creates space outside an element. Block margins can collapse in normal flow.Practice
- 37CSS basics: BordersA visible border needs a style as well as a width and color; it participates in box sizing.Practice
- 38CSS basics: Background surfacesA background should keep foreground content readable rather than carry meaning alone.Practice
- 39CSS basics: Reusable utility classesSmall utility classes should have a predictable job and avoid accidental changes to unrelated components.Practice
- 40CSS basics: Hover statesHover is one interaction state, not the only indication that a control can be used.Practice
- 41CSS basics: Focus-visible statesKeyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.Practice
- 42CSS basics: Cascade reviewWith equal origin, importance, layer, and specificity, a later declaration wins for the same property.Practice
- 43Layout and responsive: Flexible rowsA flex container lays out its direct children along a main axis; gap separates items.Practice
- 44Layout and responsive: Wrapping navigationAllow a navigation row to wrap rather than force links beyond a narrow viewport.Practice
- 45Layout and responsive: Two-column gridFractional grid tracks share available space. minmax(0,1fr) lets long content shrink within a track.Practice
- 46Layout and responsive: Repeatable card gridauto-fit repeats as many tracks as fit; the minimum controls when cards wrap.Practice
- 47Layout and responsive: Minmax tracksminmax defines a lower and upper track size; a zero minimum prevents intrinsic text width from forcing overflow.Practice
- 48Layout and responsive: Stable gapsUse gap for space between flex or grid items instead of manually adding margins to every child.Practice
- 49Layout and responsive: Intrinsic sizingA flexible image can use its natural ratio while fitting its container.Practice
- 50Layout and responsive: Content-width constraintsA width cap keeps long lines readable while inline padding protects small viewports.Practice
- 51Layout and responsive: Responsive imagesA percentage width responds to the containing block; automatic height preserves aspect ratio.Practice
- 52Layout and responsive: Mobile media queryA max-width media query applies at and below its boundary; the base layout should remain usable without it.Practice
- 53Layout and responsive: Desktop media queryA min-width query layers a wider arrangement on top of a simple mobile-first layout.Practice
- 54Layout and responsive: Source orderVisual reordering can differ from keyboard and reading order. Preserve meaningful source order instead.Practice
- 55Layout and responsive: Overflow preventionShrinkable tracks and wrapping text solve causes of overflow without hiding inaccessible content.Practice
- 56Layout and responsive: Responsive layout checkpointA robust layout combines intrinsic sizing, bounded tracks, and spacing that survives narrow widths.Practice
- 57Visual polish: Button hierarchyA primary action deserves stronger visual emphasis than secondary controls without making either unreadable.Practice
- 58Visual polish: Focus ringsA separated, visible outline makes the keyboard target identifiable without shifting layout.Practice
- 59Visual polish: Card rhythmConsistent internal spacing makes repeated content easier to compare than arbitrary per-card offsets.Practice
- 60Visual polish: Readable contrastForeground and background work as a pair. Color choice still needs contrast measurement in the real product.Practice
- 61Visual polish: Status colorsColor can reinforce a written status but should never be its only carrier.Practice
- 62Visual polish: Subtle shadowsA restrained shadow can separate surfaces; it is not a substitute for content hierarchy.Practice
- 63Visual polish: Consistent radiiA small radius system keeps related controls consistent without making every surface look like a pill.Practice
- 64Visual polish: Visual polish checkpointReadable typography, one action hierarchy, and a keyboard focus treatment are useful polish before decorative effects.Practice
- 65JavaScript basics: Constantsconst prevents reassignment of a binding. It does not deeply freeze an object stored in that binding.Practice
- 66JavaScript basics: Mutable valueslet allows a value to change; choose it when reassignment is part of the task.Practice
- 67JavaScript basics: Readable stringsStrings represent text; quotes delimit the value, while concatenation combines text without changing its meaning.Practice
- 68JavaScript basics: Number calculationsArithmetic operates on numbers. Converting units explicitly keeps an otherwise correct expression from answering the wrong question.Practice
- 69JavaScript basics: Boolean decisionsComparisons produce booleans. Strict equality avoids implicit conversion when checking a known type.Practice
- 70JavaScript basics: Conditional branchesAn if statement chooses a path from a condition; the else branch handles the other case.Practice
- 71JavaScript basics: ArraysArrays hold ordered values. Index zero refers to the first item.Practice
- 72JavaScript basics: Array lengthlength counts the array slots; the last valid index is normally length minus one.Practice
- 73JavaScript basics: Named functionsA named function groups a reusable operation; calling it runs its body.Practice
- 74JavaScript basics: Function parametersParameters let the same function work with different inputs without duplicating its body.Practice
- 75JavaScript basics: Return valuesreturn supplies a result to the caller. A function without an executed return yields undefined.Practice
- 76JavaScript basics: Template stringsBacktick template strings can interpolate expressions with ${...}; ordinary quoted strings do not interpolate them.Practice
- 77DOM and events: Query one elementquerySelector returns the first matching element or null. Guard a lookup before updating an optional element.Practice
- 78DOM and events: Query a buttonA selector should identify the intended control rather than an unrelated first button.Practice
- 79DOM and events: Click listenersAn event listener registers behavior for a future event; pass a function rather than its return value.Practice
- 80DOM and events: Text updatestextContent inserts text rather than parsing HTML, making it the appropriate choice for a plain status message.Practice
- 81DOM and events: Class additionsclassList.add adds a class without replacing unrelated classes already on the element.Practice
- 82DOM and events: Class togglesclassList.toggle alternates membership unless given an explicit force boolean.Practice
- 83DOM and events: Data attributesdataset exposes data-* values as strings; data-lesson-id becomes dataset.lessonId.Practice
- 84DOM and events: Keyboard-friendly buttonsA native button already supports keyboard activation. A click listener can serve mouse, touch, and keyboard users.Practice
- 85DOM and events: Status announcementsUpdating an existing live region can communicate a status without moving focus away from the user.Practice
- 86DOM and events: DOM behavior checkpointA reliable interaction finds its elements, guards their absence, and makes one deliberate update in response to an event.Practice
- 87Forms and validation: Form structureA form groups related input controls. This lab practices structure without submitting any data.Practice
- 88Forms and validation: Explicit labelsThe for attribute on a label connects it to the input with the matching id.Practice
- 89Forms and validation: Email input typestype="email" provides browser-level format validation. It does not prove that the mailbox exists.Practice
- 90Forms and validation: Required fieldsrequired participates in native constraint validation; identify the requirement in visible copy too.Practice
- 91Forms and validation: Help text relationshipsaria-describedby associates a control with help text identified by an existing element id.Practice
- 92Forms and validation: Error messagesAn error needs both a specific explanation and a programmatic relationship to the invalid control.Practice
- 93Forms and validation: Input descriptionsA placeholder is not a replacement for a visible label or persistent help text.Practice
- 94Forms and validation: Grouped choicesfieldset and legend give a related set of form controls a shared accessible name.Practice
- 95Forms and validation: Confirmation statesA status region can announce a completed action while leaving focus on the current control.Practice
- 96Forms and validation: Validation checkpointAn accessible input combines a label, the appropriate type, a visible requirement, and connected help.Practice
- 97Accessibility: Accessible namesVisible text usually gives a native button its accessible name. Icon-only controls need an equivalent name.Practice
- 98Accessibility: Image alternativesWrite alt text for the image purpose in this context, not every visual detail. Decorative images use alt="".Practice
- 99Accessibility: Landmark labelsDistinct names help people differentiate multiple navigation landmarks.Practice
- 100Accessibility: Keyboard orderNative links and buttons participate in keyboard navigation in source order. Positive tabindex usually creates surprising jumps.Practice
- 101Accessibility: Visible focusA keyboard target needs an obvious focus indicator. Do not remove outlines without an equally visible replacement.Practice
- 102Accessibility: Status announcementsrole="status" communicates non-urgent updates without requiring an interrupting alert or focus change.Practice
- 103Accessibility: Heading structureHeadings organize navigable topics. Styling a paragraph to look large does not give it heading semantics.Practice
- 104Accessibility: Accessibility checkpointAccessible structure should survive without color, hover, or a pointing device.Practice
- 105SEO, performance, and hosting: Unique page titlesA page title should describe this page rather than repeat the same vague label across the site.Practice
- 106SEO, performance, and hosting: Meta descriptionsA useful description summarizes the specific page. Search engines may choose a different snippet.Practice
- 107SEO, performance, and hosting: Canonical pathsA canonical link identifies the preferred URL for duplicate content; it is not a redirect or an indexing guarantee.Practice
- 108SEO, performance, and hosting: Viewport metadataA device-width viewport lets responsive layouts use the device width rather than a wide desktop layout viewport.Practice
- 109SEO, performance, and hosting: Asset dimensionsExplicit image dimensions reserve layout space. Below-the-fold images may be lazy-loaded; a hero usually should not be.Practice
- 110SEO, performance, and hosting: Robots guidanceA robots meta noindex directive asks compatible crawlers not to index a page; they must be allowed to fetch it to see the directive.Practice
- 111SEO, performance, and hosting: Helpful 404 pagesA useful not-found page offers recovery links, but the server must still return HTTP 404 rather than disguising it as success.Practice
- 112SEO, performance, and hosting: Launch checklistA static page needs clear metadata and crawlable links; testing rendering alone does not verify HTTP behavior or indexing.Practice
- 113Capstone builds: Personal profileA profile should introduce its subject, expose relevant work, and provide clear navigation rather than a collection of unlabeled boxes.Practice
- 114Capstone builds: Event landing pageAn event page should answer what, when, and where before asking someone to take action.Practice
- 115Capstone builds: Accessible signup flowA signup interface combines labeled controls, a visible requirement, help, and a non-submitting review action in this sandbox.Practice
- 116Capstone builds: Course dashboardA course dashboard should show an honest progress measure and the next useful action.Practice
- 117Capstone builds: Service status pageStatus needs a readable state, an observation time, and context that distinguishes an incident from an assumption.Practice
- 118Capstone builds: Resource directoryA directory groups resources under meaningful headings and uses links that identify their destinations.Practice
- 119Capstone builds: Portfolio case studyA case study explains the problem, the work, and the evidence for the result without inventing impact metrics.Practice
- 120Capstone builds: Web foundations finaleThe final page brings together document metadata, semantic structure, readable navigation, and a usable primary action.Practice
Workshop reference
Use Run & inspect to examine the current code, Check lesson to verify the complete pattern, and the file tabs to switch between HTML, CSS, and JavaScript. Examples are cumulative; use the hint only when you need it.
HTML and CSS use a safe inert preview. JavaScript is structurally checked, not executed.
Preview behavior and limits