The reading room
Web development guides.
Accessible HTML, responsive CSS, HTTP, and the mechanics of publishing a usable static website.
40 guides · Examples, explanations, and practical limits.
In this topic
40 articles
Give a page a semantic HTML structure
Use semantic elements to identify the main content, navigation, and surrounding page structure. These elements provide meaning independently of the visual layout…
Organize an article with meaningful headings
Use headings to describe the document’s sections. A clear page heading followed by section headings helps readers scan the article and navigate it with assistive…
Choose a link or button for an interaction
Use a link for navigation to another location and a button for an action within the current interface. Native elements provide keyboard and interaction behavior that…
Give a form input an explicit label
Associate a visible label with an input by matching the label’s for attribute to the input’s unique ID. A placeholder can supplement a label but should not replace it.
Connect validation messages to form fields
When a field has a validation error, describe the problem in text and connect that message to the field. Aria-invalid can expose its state, while aria-describedby…
Create a disclosure with details and summary
Use details and summary for a simple expandable section without writing custom toggle JavaScript. Put the control’s visible label in summary and the hidden-by-default…
Open a native modal dialog
Use dialog.showModal for a native modal dialog. Give it a meaningful heading and an obvious close action, and test focus movement as part of the interaction.
Mark up a small data table
Use a table for data with meaningful row and column relationships. Add a caption and appropriate header cells so the relationships remain understandable beyond the…
Write useful image alternative text
Choose alternative text according to the image’s role. Describe meaningful information, and use an empty alt attribute for a decorative image that adds no content to…
Serve responsive images with srcset and sizes
Use width descriptors in srcset and a matching sizes attribute to help the browser choose an image suited to the rendered slot and device pixel density.
Lazy-load images below the initial viewport
Add loading lazy to noncritical images farther down a page. Keep important initial content, such as a prominent first image, immediately discoverable and reserve…
Set a useful viewport for responsive pages
Include a viewport meta tag so mobile browsers lay out a responsive page using the device width. Pair it with flexible CSS rather than fixed desktop-width containers.
Find the element causing horizontal overflow
Investigate oversized content before hiding horizontal overflow on the whole page. Common causes include fixed widths, long code lines, large images, and grid…
Build a responsive card grid
Use CSS Grid with auto-fit and minmax to arrange cards according to the available width. Let the grid collapse naturally instead of requiring a separate breakpoint…
Let long content shrink inside a flex row
Give a flexible text child min-width zero when its intrinsic minimum size prevents a flex row from shrinking. Add an explicit wrapping policy for unusually long tokens.
Make a sidebar sticky within its layout
Use position sticky with a top offset for a sidebar that follows scrolling within its containing layout. Unlike fixed positioning, it remains tied to its normal…
Use border-box to simplify width calculations
Use box-sizing border-box when declared widths should include padding and borders. This makes percentage-width fields and constrained panels easier to reason about.
Scale a heading with CSS clamp
Use clamp to give a heading a fluid preferred size bounded by readable minimum and maximum sizes. Combine relative units so the design can respond to both viewport…
Keep a visible keyboard focus indicator
Use focus-visible to provide a clear focus indicator for keyboard interaction. Preserve a usable native focus state rather than removing outlines without a replacement.
Respect a reduced-motion preference
Use prefers-reduced-motion to reduce nonessential motion for people who request it. Apply the change to the actual moving components instead of assuming a single…
Communicate status with text as well as color
Present status using meaningful text as well as visual color. A label such as Failed or Complete remains useful when color differences are hard to perceive or styles…
Add a skip link to repeated navigation
Put a skip link near the start of the document so keyboard users can move past repeated navigation to the main content. Keep the link visible when it receives focus.
Declare the page’s language
Set lang on the root HTML element to identify the page’s primary language. Mark a passage with its own language when it differs meaningfully from the surrounding text.
Mark up a date with the time element
Use time with a datetime attribute to pair a readable date with a machine-readable value. Choose a date-only value or an offset-bearing timestamp according to what…
Use a download link for a same-origin file
Use the download attribute to suggest saving a same-origin resource with a chosen filename. It is a browser hint and does not override every server header or…
Make new-tab links explicit
When a link genuinely needs a new tab, use target blank and an explicit noopener relationship. Let the link text indicate the external destination so readers can…
Submit a simple search form with GET
Use a GET form when submitting a shareable query that retrieves information without changing server state. Named controls become query parameters in the destination URL.
Understand what robots.txt controls
Robots.txt gives cooperating crawlers rules about requesting paths. It is not an access-control system and does not reliably remove a URL from search results by itself.
Declare a canonical URL consistently
A canonical link identifies the preferred URL for a page or a set of substantially duplicate pages. Use a consistent absolute URL that matches your internal links and…
Write a useful meta description
Write a short, accurate description of what a page helps the reader do. Give each article a description suited to its actual contents rather than repeating a…
Create a small XML sitemap
List preferred public URLs in an XML sitemap to help crawlers discover them. Include an accurate modification date only when it represents a meaningful change to that…
Return a real 404 for a missing page
A missing page should normally return HTTP status 404, even when its body contains a friendly custom error design. A page that looks missing but returns 200 can…
Choose cache rules for HTML and versioned assets
Use different cache policies for frequently updated HTML and content-addressed assets. HTML can require revalidation, while a uniquely versioned asset can be cached…
Understand ETag revalidation
An ETag is a validator for a particular representation of a resource. A client can send it back with If-None-Match so the server can answer 304 when the…
Fix CORS at the server boundary
A browser CORS error usually means the remote response does not grant your page permission to read it. Fix the server policy or use an authorized backend; changing…
Fix HTTP resources on an HTTPS page
Load a secure page’s subresources over HTTPS. An HTTP script, stylesheet, request, or embedded asset can trigger mixed-content blocking or upgrading behavior…
Serve files with the correct Content-Type
Set Content-Type to describe the bytes a response actually contains. A JavaScript or JSON URL that returns an HTML fallback can fail even though the request status is…
Choose relative links carefully on nested pages
A relative link resolves against the current document URL. On a nested static site, use root-relative paths for shared site navigation and intentional local paths for…
Keep core content usable without JavaScript
Render essential text and navigation in HTML, then add JavaScript for optional convenience. For an article directory, all article links can exist before a script adds…
Make an article easier to print
Add print-specific CSS to remove repeated navigation and preserve readable article content. Check code blocks, page breaks, and link meaning in an actual print preview.
No matching articles. Try another title or topic.