FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

125 snippets foundClear filters
HTMLDocument structure

Pair terms and descriptions

Use a description list for a small HTML glossary.

HTML✓ Tested
HTMLMetadata & document links

Provide a concise page description

HTML: A description meta element summarizes a document for clients that use that metadata.

HTML✓ Tested
HTMLGetting Started

Provide a list of selectable options

HTML: Learn how to provide a list of selectable options in a complete browser example.

HTML✓ Tested
HTMLLinks & accessibility

Provide a skip link

Let keyboard users jump directly to focusable main content.

HTML✓ Tested
HTMLAccessible structure

Remove an inactive section from keyboard navigation

HTML: Inert prevents interaction and accessibility exposure for an inactive subtree.

HTML✓ Tested
HTMLTables & list numbering

Represent a hierarchy with nested lists

HTML: Place the nested list inside its parent list item to preserve the hierarchy.

HTML✓ Tested
HTMLNative disclosure & dialogs

Represent progress whose total is unknown

HTML: Omit value to make a progress element indeterminate.

HTML✓ Tested
HTMLText semantics

Represent removed and inserted text

HTML: Del and ins record a textual change while retaining both versions in the document.

HTML✓ Tested
HTMLInput constraints

Require a checkbox to be selected

HTML: A required checkbox is invalid until that individual control is checked.

HTML✓ Tested
HTMLGetting Started

Require a form field

HTML: Learn how to require a form field in a complete browser example.

HTML✓ Tested
HTMLInput constraints

Require a nonempty text value

HTML: The required attribute makes an empty text control fail native constraint validation.

HTML✓ Tested
HTMLInput constraints

Require numeric values on a chosen step

HTML: The step interval is measured from the minimum value when one is provided.

HTML✓ Tested