Dev Helpers

Developer journal

CSS

Layout, typography and interaction details you can inspect in the browser.

← All categories

CSS

Fluid width with a maximum

A fluid container needs a small-screen width and a large-screen maximum. Outer gutters should remain visible at both extremes.

Square aspect ratio

A square ratio reserves equal sides even before media loads. Fit rules decide whether rectangular content is cropped or letterboxed.

Minimum inline size

A logical minimum inline size protects a component from collapsing beyond its usable width. An overly large minimum can force overflow.

Minimum block height

Minimum block size reserves space along the writing mode's block axis. Content can still make the element grow.

Apply fluid spacing with a ceiling

A clamp combines a minimum, a fluid middle value and a maximum. The ceiling keeps generous desktop spacing from growing indefinitely.

Zoomed detail window

A magnified detail window needs a clipping area and an independently scaled subject. Scaling the outer frame would enlarge the wrong part.

Move the grid tracks to the corner

Grid content alignment positions the track group when spare space remains inside the container. Alignment is harder to see when tracks fill all available space.

Widescreen aspect ratio

A widescreen frame establishes height from width without an arbitrary breakpoint. It makes embedded media more predictable as the parent resizes.

Selection background swatch

Selection styling needs foreground and background colours that remain readable as a pair. Test actual selected text rather than an isolated colour chip.

Border-box sizing

Border-box sizing includes padding and borders in a declared width. This is useful when several cards must share a precise grid.

Make a text cursor easier to see

Caret colour is a small edit with a large effect on dark inputs. Check the insertion point against normal, focused and selected backgrounds.

Keep text on one line

A single-line label avoids awkward breaks but can run wider than its parent. Decide where overflow belongs before disabling wrapping.

Change cursor on a resizable handle

A resize cursor tells a pointer user which direction a handle moves. The drag behaviour and keyboard equivalent still need to be implemented by the control.

Pin a label to the preview viewport

Fixed positioning follows a containing block that is usually the viewport. A transformed ancestor can establish a different reference frame.

Clip a swatch to a diamond

A polygon clip can turn a square swatch into a diamond while its allocated layout box stays rectangular.

Build price bands for repeated items

A price band is useful when an item appears on more than one order line. Group by item before choosing the smallest and largest unit prices.

Width that follows content

A content-sized label can hug short text while still needing a boundary for long text. Intrinsic sizing lets the content influence the box.

Maximum reading width

Reading measure is a typography decision as much as a layout decision. A maximum width helps a text column stay readable on a wide screen.

Content-box sizing

Content-box sizing assigns the declared size to the content area. Padding and borders increase the final occupied space.

Rotate a swatch

Rotation changes painting and hit testing while preserving the element's original layout footprint. Leave enough room for the rotated corners.

Ruby pronunciation note

Ruby markup associates a short annotation with base text. CSS controls its arrangement while the HTML retains the reading relationship.

Perforated tear line

A repeated line can suggest a perforation without requiring an image asset. Its rhythm should hold up as the panel width changes.

Numbered instructions marker

A list marker can carry instructional numbering while the list retains native ordered semantics. Keep the numbers legible at wrapping widths.

Round every corner

A radius follows the border box. Child backgrounds can still paint outside the curve unless clipping or matching radii are part of the design.

Horizontal flex row

A flex row lays out siblings on its main axis. The children's minimum sizes determine how gracefully the row shrinks.