10 HTML Tricks Experts Use That You Can Start Using Today
Discover ten lesser-known HTML features that solve real problems without JavaScript. From native modals to semantic progress indicators, these patterns...
The <dialog> element gives you a fully accessible modal dialog with built-in focus management, backdrop styling, and keyboard dismissal. No focus-trap libraries, no portal components, no z-index wars.
Open it with dialog.showModal() and close with dialog.close(). The ::backdrop pseudo-element styles the overlay. Form submission with method="dialog" closes the dialog automatically and sets dialog.returnValue.
Accordions that work without JavaScript
<details> and <summary> create native disclosure widgets. The browser handles open state, keyboard interaction, and ARIA attributes automatically.
Code
<details>
<summary>Shipping rates</summary>
<p>Free shipping on orders over $50.</p>
<p>Standard delivery: 3-5 business days.</p>
</details>
Add the open attribute to start expanded. Style the disclosure triangle with summary::marker or hide it and use a custom icon. Nested <details> elements work correctly without extra effort.
Client-side templates the browser already parses
<template> elements are inert - their content doesn't render, scripts don't execute, images don't load. Clone template.content and append it wherever you need.
This avoids innerHTML strings and keeps your template in HTML where it belongs. The cloned DocumentFragment inserts efficiently in a single DOM operation.
Responsive images without CSS hacks
<picture> with <source> elements lets the browser choose the right image based on viewport, pixel density, or format support. No JavaScript, no layout shift.
Add media attributes for art direction - different crops for different breakpoints. The <img> is required as the fallback and provides the accessibility attributes.
Autocomplete that actually helps users
<datalist> provides native suggestions for text inputs. Users see a dropdown as they type, but can still enter free text. It's not a replacement for <select> when the value must come from a fixed list.
Combine with autocomplete="framework" (or a custom token) so password managers and browsers can prefill intelligently.
Semantic progress that screen readers announce
<progress> represents task completion. <meter> represents a scalar measurement within a known range - disk usage, battery level, exam score. Both expose value semantics to assistive technology.
Style with progress[value] and meter selectors. The optimum, low, and high attributes let browsers color-code the meter automatically.
Calculation results that announce to screen readers
<output> represents the result of a calculation. Pair it with <input type="range"> and the for attribute to create accessible sliders that announce the current value.
The for attribute links the output to its controlling inputs. Screen readers announce the output value when it changes.
Mobile keyboards that match the input type
The inputmode attribute tells mobile browsers which virtual keyboard to show, independent of the input type. Use numeric for PINs, decimal for prices, email for addresses, url for links, search for search fields.
The pattern"[0-9]*" on iOS triggers the numeric keypad reliably. autocomplete="one-time-code" lets iOS suggest SMS codes automatically.
Form autofill that works across browsers
Specific autocomplete values tell password managers and browsers exactly what each field expects. The spec defines over 50 tokens - name, email, street-address, postal-code, cc-number, cc-exp, cc-csc, new-password, current-password, one-time-code.
Use autocomplete="off" only for fields that must never be stored - one-time tokens, CAPTCHA responses. For everything else, be specific.
Editable content that behaves like a form field
contenteditable="plaintext-only" lets users edit text directly while preserving line breaks but stripping formatting. Combined with the input event, it creates a lightweight rich-text alternative.
The plaintext-only value (supported in modern browsers) prevents pasted HTML from creating nested elements. Add role="textbox" and aria-multiline" for accessibility.
Machine-readable dates that humans can read
<time> with a datetime attribute gives you both: a human-friendly format and an ISO 8601 timestamp for search engines, calendars, and screen readers.
Microformats like h-entry and schema.org BlogPosting expect <time class="dt-published" datetime="...">. The element is inline by default and requires no JavaScript.
Putting it together
These ten features share a pattern: the browser already implements the hard parts - focus management, keyboard navigation, ARIA mapping, platform integration. Your job is to use the right element and provide the right attributes.
Start by auditing your codebase for custom modal components, accordion scripts, template strings, image srcset gymnastics, and hand-rolled autocomplete widgets. Replace them one at a time. The resulting code is smaller, more accessible, and easier to maintain.
HTML has grown quietly while frameworks grabbed attention. The features described here are stable, widely supported, and ready for production. They don't require a build step, a dependency, or a migration guide. They just work.
Build faster with ReadyTools
Discover ReadyTools: the ultimate productivity suite for creators. Beautiful Linksy pages, smart Lara AI, project management, secure cloud storage, and everything else you need — all together. Start your 7-day free trial today.
From synchronization engines to suggestion modes, the July 14-21 updates show what happens when a collaborative editor invests in the layers users rarely..
A rapid sequence of updates brings Features, Statistics, Logos, Comparison, and Skills modules, complete appearance control for Plus and Max users, and a..