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.
- Set up favicons for browsers and home screens
A simple favicon setup that covers modern browsers and devices without generating dozens of unnecessary files.
- Better One-Time Code Inputs Without Six Tiny Boxes
Use one labelled input for verification codes, with paste, a numeric keyboard, and autofill. Keep leading zeroes and validate the code on the server.
- Getting Form Data With the FormData API
Use FormData to collect named form fields, inspect values, handle checkboxes and files, and send data with fetch while keeping normal form submission.
- requestSubmit() vs submit(): validation and events
Compare requestSubmit() and submit() for JavaScript form submission. Keep browser validation and submit events, and choose which button submits the form.
- JavaScript Module Scripts Are Deferred by Default
JavaScript module scripts are deferred by default. Use imports and head entry points, understand async exceptions, and distinguish parsing from readiness.
- defer, async, and type="module": How Scripts Actually Load
Compare defer, async, and type="module" script loading. Choose execution timing for DOM access and dependencies, including inline scripts and their limits.
- What CSS appearance Actually Does
CSS appearance changes a form control’s styling. Restyle a select, add its arrow back, and keep labels, focus, and checked states easy to recognise.
- Style Native Form Controls With accent-color
Use accent-color to style native checkboxes, radios, sliders, and progress indicators. Keep their behaviour, set up dark mode, and check focus states.
- Using HTML Attribute Values Inside CSS With attr()
CSS attr() reads HTML attributes for generated labels and typed calculations. Use working examples, check support, and handle missing or invalid values.
- What the Browser Already Does Without a Framework
Before adding a frontend framework, check what HTML, CSS, forms, responsive images, preferences, and browser navigation already provide.
- Choosing Between srcset and picture
Choose srcset when the image stays the same and picture when the crop, composition, or format needs to change.
- Finding Hidden Content With hidden="until-found"
Let Find in Page and fragment navigation reveal collapsed content with hidden=until-found, while keeping a usable fallback.
- The HTML Details That Make Forms More Accessible
Build clearer forms with visible labels, autocomplete, connected help and errors, fieldsets, and visible focus.
- When a Control Needs aria-label
Use aria-label for genuinely unlabelled controls while keeping visible text and native elements as the first choice.
- When CSS Layout Order Stops Matching the HTML
Keep Grid and Flexbox layouts aligned with the HTML order so keyboard focus and screen reader reading do not jump around the page.
- Why Images Need width and height Attributes
Width and height attributes tell the browser an image's aspect ratio early enough to reserve space and prevent layout shifts.
- When to Use fetchpriority on Images
Give a genuinely important image a priority hint without marking every request urgent or combining contradictory loading instructions.
- What You Get With a Real HTML Button
A native HTML button includes keyboard, focus, form, disabled, and accessibility behaviour that a clickable div must rebuild.
- When to Use a Link or a Button
Choose links for navigation and buttons for actions, then style either element to match the interface.
- The Difference Between HTML meter and progress
Use the HTML meter element for a value within a known range and progress for work moving towards completion.