All HTML guides

Find a guide to sharing, fixing or building an HTML page.

Guides 901-960 of 2735. Page 16 of 46.

noscript tag
The HTML noscript tag: when it shows and what to put in it
The HTML noscript tag shows its content only when JavaScript is turned off, not when a script fails. Live examples, head vs body rules and mistakes to avoid.
nowrap css
white-space: nowrap and the other ways CSS handles spaces and line breaks
white-space: nowrap keeps text on one line. See nowrap, pre, pre-wrap, pre-line and break-spaces side by side, plus text-wrap balance and pretty.
sticky footer css
Sticky footer in CSS: keep the footer at the bottom
Keep the footer at the bottom of short pages with flexbox or grid and min-height: 100dvh. Live examples, plus why position fixed and sticky differ.
sidebar html
Build a sidebar with HTML and CSS
Build a sidebar in HTML with aside and CSS grid, make it sticky, turn it into a drawer on phones and collapse it to icons. Live examples and code to copy.
stopwatch html
Build a stopwatch in HTML and JavaScript
Build a stopwatch in HTML and JavaScript with performance.now(), pause and resume, lap times and digits that do not jitter. Live examples to try and code to copy.
flip card html
Build a flip card in HTML and CSS
Build a flip card in HTML and CSS with perspective, preserve-3d and backface-visibility. Hover or click to flip, keyboard support, and cards that fit their text.
css scroll snap
CSS scroll snap: make scrolling stop on whole items
CSS scroll snap in plain words: scroll-snap-type, scroll-snap-align, scroll-snap-stop and scroll-padding. Live examples to try, and fixes when nothing snaps.
css transition
CSS transition, one property at a time
How CSS transition works: property, duration, delay, ease, cubic-bezier and steps, allow-discrete for display: none, and the transitionend event.
css transform origin
CSS transform-origin: choose the point things turn around
How CSS transform-origin picks the point an element rotates and scales around: keywords, percentages, px, the 3D z value and transform-box for SVG. Live demos.
urlsearchparams
Read and write query strings with URLSearchParams
Read ?q=... from the address, build a query string from a form, and update the address bar without a reload. get, getAll, set, append and encoding, live.
svg stroke dasharray
SVG stroke-dasharray and stroke-dashoffset, with live examples
How stroke-dasharray and stroke-dashoffset cut an SVG stroke into dashes, draw a line on screen and fill a progress ring. Live examples, code and fixes.
css offset path
CSS offset-path: move an element along a curve
Make a dot follow a curve with CSS offset-path and offset-distance: path(), ray(), circle(), offset-rotate and offset-anchor, with live examples to copy.
css fill svg
CSS fill and stroke on SVG, including holes and outlines
Style SVG shapes from CSS with fill and stroke, cut holes with fill-rule evenodd, fade them without a dark band, and outline text with paint-order. Live examples.
view transition css
Animate page changes with CSS view transitions
Wrap a DOM change in document.startViewTransition() and style it with view-transition-name and ::view-transition-old/new. Live examples, fallback and reduced motion.
css scroll timeline
CSS scroll timelines: animations driven by scrolling
Run a CSS animation on scroll instead of time: animation-timeline with scroll() and view(), named timelines, timeline-scope and animation-range, plus a fallback.
css touch action
CSS touch-action: decide who gets the finger
What each touch-action value lets the browser do, why a finger drag scrolls the page, and how overscroll-behavior stops scroll chaining and pull-to-refresh.
css caret color
CSS caret-color: colour and shape the text cursor
Change the blinking text cursor colour with caret-color, try the block and underscore shapes of caret-shape, and build a terminal-style caret. Live examples.
css appearance none
CSS appearance: none, control by control
What appearance: none removes on each form control, why checkboxes vanish, and the states you must redraw. Live examples to toggle, test and copy.
css color scheme
CSS color-scheme: what it changes and how to use it
The CSS color-scheme property tells the browser which schemes a page supports, so inputs, scrollbars and default colours go dark. Live examples and light-dark().
list style type html
list-style-type: change the bullets and numbers of an HTML list
Change list bullets and numbers with list-style-type: every value, custom strings and emoji, list-style-image, inside or outside, ::marker and @counter-style.
css min width 0
CSS min-width: 0 and why flex and grid items overflow
Why a flex or grid item refuses to shrink and pushes things off screen, and how min-width: 0, minmax(0, 1fr) and clamp() fix it. Live demos you can edit.
css grid auto flow
CSS grid-auto-flow: how the browser places the items you did not place
How CSS grid-auto-flow places items: row, column and dense, how grid-auto-rows and grid-auto-columns size the tracks the browser adds, and a masonry-style gallery.
css flex shrink 0
CSS flex-shrink: 0 and why flex items squash
Why icons, avatars and buttons get squashed in a flex row, how flex-shrink: 0 stops it, and how the browser decides who shrinks most. Live demos and fixes.
css justify self
CSS justify-self and justify-items, and why flexbox ignores them
justify-self moves one grid item left, center or right inside its cell. Try it live with justify-items and place-self, and see why flexbox ignores it.
css hyphens auto
CSS hyphens: auto, and why it needs a lang attribute
hyphens: auto splits long words at syllables, but only when the page sets a language. Try none, manual and auto live, plus ­, hyphenate-character and justify.
text indent css
Text indent in CSS: first lines, hanging indents and drop caps
Indent the first line of a paragraph with CSS text-indent, make a hanging indent for reference lists, and add a drop cap with ::first-letter. Live demos and code.
filereader javascript
FileReader in JavaScript: read a file the user picked
Read a picked file in the browser with FileReader: readAsText, readAsDataURL and readAsArrayBuffer, onload and onerror, file.text(), image previews and CSV tables.
intl numberformat javascript
Format numbers with Intl.NumberFormat
Format numbers in JavaScript with Intl.NumberFormat: currency, percent, units, 1.2K compact notation, decimal places, formatToParts, and a live price formatter.
web worker javascript
Web Workers in JavaScript: run heavy work without freezing the page
Run heavy JavaScript in a Web Worker so the page never freezes. One-file setup with a Blob URL, postMessage, progress, cancel with terminate, and transferables.
crypto randomuuid
crypto.randomUUID() and getRandomValues(): IDs and passwords nobody can guess
Make a UUID with crypto.randomUUID(), build short IDs and passwords with crypto.getRandomValues(), and fix the "not a function" error on http pages. Live examples.
location hash javascript
location.hash in JavaScript: read it, set it, react to it
Read and set location.hash in JavaScript, react with the hashchange event, and build hash tabs for a one-file page. Live examples, encoding rules and history.
mediarecorder javascript
Record a canvas to video with MediaRecorder in JavaScript
Record a canvas animation to a video file with MediaRecorder and captureStream, no camera needed. Pick a mimeType, collect chunks, download the file, add sound.
textencoder javascript
TextEncoder and TextDecoder in JavaScript
Use TextEncoder and TextDecoder to count real UTF-8 bytes, catch broken input with fatal, and Base64-encode Korean or emoji text. Live examples and code to copy.
audiocontext javascript
AudioContext in JavaScript: build a synth with the Web Audio API
Make sound with an AudioContext: oscillators, gain envelopes that stop clicks, resume() for autoplay, a playable keyboard synth and an AnalyserNode visualiser.
html context menu
Build a custom HTML context menu (right-click menu)
Build a custom right-click menu with the contextmenu event. Keep it on screen, close it on Escape or a click outside, and open it by keyboard and long press.
line chart html
Build a line chart in HTML with plain SVG
Draw a line chart in HTML from an array of numbers with plain SVG and a short script: scales, axes, gridlines, hover tooltip, responsive viewBox, several series.
flowchart html
Build a flowchart in HTML, CSS and SVG
Build a flowchart in HTML with no library: CSS grid or flex places the boxes, SVG paths draw the arrows from measured positions, and a ResizeObserver redraws them.
webgl html
WebGL in HTML, from a blank canvas to a textured shape
WebGL in a plain HTML page: get a context, write a vertex and a fragment shader, fill a buffer, animate with uniforms and add a texture. Live examples and fixes.
html validator
HTML validator: what it checks, and why your page looked fine anyway
What the W3C Nu HTML validator checks, the errors it finds most often, and how browsers quietly repair them. Live demos show the repaired tree and a small checker.
math tag
The HTML math tag: write formulas with MathML
Write formulas in HTML with the <math> tag: mi, mn, mo, fractions, powers, subscripts and square roots. Live examples, a tested browser table and accessibility tips.
get input value javascript
Get an input value in JavaScript, for every kind of input
Read what a user typed or picked: .value, valueAsNumber, valueAsDate, checked, selects, radio groups and FormData. Live examples, a working calculator and fixes.
css content visibility
CSS content-visibility: render only what is on screen
How CSS content-visibility skips off-screen rendering, why it needs contain-intrinsic-size, and what auto and hidden do to Ctrl+F, focus and screen readers.
css border left
CSS border-left and the other single sides
Put a border on one side with border-left, border-top, border-bottom or border-right. Accent bars, underlines, logical sides for RTL, and triangles, with live code.
css border image
CSS border-image, explained with live examples
How CSS border-image cuts a picture into nine pieces and draws it as a border. Live examples for slice, fill, width, outset and all four repeat modes.
css margin left auto
CSS margin auto: push, centre and pull with margins
What margin-left: auto does in a flex row, how margin: 0 auto centres a block, margin-top: auto in a column, collapsing margins and negative margins, tried live.
css bottom
CSS bottom, top, left, right and the inset shorthand
What CSS bottom, top, left and right measure from, how the inset shorthand works, and how inset: 0 stretches a box. Live examples, a pinned card footer and fixes.
css object position
CSS object-position: choose which part of the picture stays
How CSS object-position places an image inside its box: keywords, percentages, edge offsets, focal points for avatars and banners, and animating it. Live demos.
css text emphasis
CSS text-emphasis: emphasis marks over and under text
Put sesame dots or circles over or under text with CSS text-emphasis. Set the shape, color and side, and fit numbers in vertical text. Live examples.
css field sizing
CSS field-sizing: form fields that fit their text
field-sizing: content makes inputs, textareas and selects size to their text. Live examples, min and max limits, a support check and a short JavaScript fallback.
css text box trim
Trim the space around text with CSS text-box-trim
Use text-box-trim and text-box-edge to cut the empty space above capitals and below the baseline, so buttons and headings line up. Live examples, code, fallback.
italic html
Italic and bold in HTML: the tags, and the CSS behind them
Make text italic or bold in HTML with a tag or CSS. Live examples of font-style italic and oblique, font-weight numbers, fake italic and bold, and variable weights.
css font variation settings
CSS font-variation-settings and variable fonts
Set wght, wdth, slnt, opsz and custom axes with font-variation-settings, or with font-weight and font-stretch. Live sliders, a system font that works, and fixes.
cite tag
The HTML cite tag, the cite attribute, and dfn
What the HTML cite tag is for, how it differs from the hidden cite attribute on q and blockquote, and how dfn, abbr and links build a glossary readers can use.
svg marker
SVG markers: arrowheads on lines and paths
Put arrowheads on SVG lines and paths with the marker element: marker-start, marker-mid, marker-end, orient, markerUnits and context-stroke, with live examples.
svg gradient
SVG gradients: linearGradient, radialGradient and their stops
Fill SVG shapes, text and strokes with linearGradient and radialGradient. Stop offsets, stop-opacity, gradientUnits, spreadMethod and fixes, with live examples.
svg filter
SVG filter: build effects from primitives, apply them to any element
Build SVG filters from primitives: feGaussianBlur, feDropShadow, feColorMatrix, feFlood, feComposite and feDiffuseLighting, then apply them to HTML with CSS.
pinch zoom html
Pinch zoom an image or map in HTML
Pinch to zoom an image or map inside a page with pointer events: two fingers, zoom around their midpoint, Ctrl + wheel on desktop and a reset button. Live examples.
swipe html
Swipe gestures in HTML: cards that follow the finger
Add swipe gestures to HTML with pointer events: follow the finger, decide on distance or speed, tell a swipe from a scroll, and use touch-action: pan-y. Live code.
div vs span
div vs span: which one to use, and why
div is a block box for layout, span is an inline box for a few words. See the layout boxes in a live demo, check for a meaningful tag first, and avoid nesting traps.
meta charset html
meta charset in HTML: what it does and why it goes first
What meta charset="utf-8" does, why it must sit in the first 1024 bytes, and how a BOM or the server header overrides it. Live demos decode the same bytes.