HTML
Make the most of native HTML. Semantic elements, accessible forms, browser features, and simpler ways to structure content for the web.
Browse 54 articles in this topic. View all topics.
- Showing Calculation Results With HTML output
Use the HTML output element for totals, slider values, estimates, and other results produced by form controls.
- Input Suggestions With HTML datalist
Add native suggestions to an HTML input with datalist while still allowing values outside the provided list.
- HTML autocomplete Values Worth Using
Give browsers useful autocomplete tokens for identity, contact, address, password, and one-time-code fields.
- What the HTML search Element Is For
Use the HTML search element to identify search and filtering controls without changing how the form submits or looks.
- Show Form Errors After Interaction With :user-invalid
Use :user-invalid and :user-valid to style native HTML validation states without marking untouched fields as errors.
- Image Alt Text: When to Use It and When Not To
Write useful image alt text by deciding what an image contributes, including when the right alt value is empty.
- Expandable sections with HTML details and summary
Build simple accordions and disclosure sections with the native HTML details and summary elements.
- Building a modal with HTML dialog
Build modal windows from the native HTML dialog element, including backdrops, forms, Escape handling, and practical examples.
- HTML Popover API: Popovers Without JavaScript
Create menus, help boxes, and other lightweight overlays with the native HTML Popover API and very little code.
- Native HTML and CSS Features That Replaced JavaScript
Choose native HTML and CSS before custom JavaScript. Compare dialogs and popovers, then use native forms and layout rules without rebuilding behaviour.
- How to Hide Content Accessibly
Choose between display none, visibility hidden, opacity, aria-hidden, hidden, and visually hidden text based on behaviour.
- Why You Shouldn't Lazy-Load Every Image
Lazy loading helps below the fold, but adding loading=lazy to every image can delay important content and hurt Largest Contentful Paint.
- When to Use preload, prefetch, and preconnect
Choose between preload, prefetch, and preconnect without turning resource hints into extra work for the browser.
- What HTML forms can do without JavaScript
Native HTML forms already provide input types, validation, autocomplete, mobile keyboard hints, and other useful behaviour.
- Show Better Mobile Keyboards With HTML inputmode
Use HTML inputmode to request a more useful mobile keyboard for numbers, phone numbers, email, URLs, and search.
- Making a page section inactive with HTML inert
Use the HTML inert attribute to temporarily remove a page section from focus and interaction.
- Loading videos only when they're needed
Delay video downloads with preload settings or Intersection Observer, depending on whether the video waits for a click or plays automatically.
- Cutting Elements Into Shapes With CSS clip-path
Use CSS clip-path to reveal circles, polygons, insets, and other shapes without editing the original image.
- Preload, Preconnect, or Prefetch?
Choose between preload, preconnect, and prefetch based on when the browser will need a resource.
- Make an Iframe Responsive With CSS
Keep videos, maps, and other iframes responsive with an aspect-ratio wrapper and a small amount of CSS.