Designing a user interface in HTML means planning what a person sees, reads, and operates—then expressing that plan with semantic markup that browsers, assistive technology, and search engines can all understand. The key condition is that HTML owns structure, meaning, and native behavior, while CSS handles appearance and JavaScript handles dynamic behavior; a design that violates this division becomes fragile and inaccessible. The workflow below moves from purpose and layout to semantic structure, forms, navigation, styling, interaction, and finally testing—each step producing something you can verify before the next. It assumes you know basic HTML tags and can edit a file in a text editor, nothing more. Working through the sequence in order prevents the common failure of polishing pixels before the underlying document makes sense.

Start With the User's Task, Not the Layout

Before writing a tag, write one sentence describing what the screen must let someone accomplish: "A returning customer checks order status and requests a return," or "A new member creates an account with an email and password." This sentence determines everything downstream—which elements are primary, what the form collects, where errors appear, and what counts as success.

From that sentence, list the content blocks in priority order. A typical page has a header with identity and primary navigation, a main region containing the task, and a footer with secondary information. Decide which block a sighted user should notice first and which must remain reachable by keyboard. Sketching the order as a plain list of headings before any visual design forces you to confront unclear priorities early; if you cannot rank the blocks, the interface concept is not yet settled.

Define the states of the screen as well: empty, loading, partially filled, error, and success. Interfaces are usually designed in their happy state and break in the others, so naming the states now tells you which markup and messaging you will need. For a sign-up form, for example, the error state needs a place to announce what went wrong, and the success state needs a clear confirmation region.

Choose the Document Skeleton and Language Settings

Every page begins with a small set of declarations that shape how browsers interpret everything else. The doctype triggers standards mode; without it, browsers may fall back to legacy rendering quirks. The lang attribute on the html element tells screen readers which pronunciation rules and which language-specific hyphenation to use, and it also matters for translation tools.

The viewport meta tag matters for phones: without it, mobile browsers assume a desktop-width page and shrink everything, producing text too small to read. The title element is not decoration—it labels the browser tab, appears in bookmarks and history, and is the first thing a screen reader announces when a page loads, so make it specific and front-load the distinctive part.

If the page contains passages in another language, mark those passages with their own lang value rather than switching the whole document. This is a small habit that pays off in pronunciation accuracy for multilingual audiences.

Build Structure With Semantic Landmarks and Headings

Semantic elements describe what a region is, not how it looks. A header, nav, main, and footer create landmarks that assistive technology users can jump between; a page built entirely from div elements offers no such shortcuts. The main element should appear once per page and wrap the content unique to that page, excluding repeated site chrome.

Headings form the outline of the document. Use one h1 that names the page, then h2 for major sections and h3 for subsections, without skipping levels for visual reasons. Headings are the primary way screen reader users skim, and a well-ordered heading tree functions as a table of contents. If a design calls for small text, style it with CSS rather than demoting the heading level.

When a landmark repeats on the same page—two navigation regions, for instance—give each a distinct accessible name with aria-label. The label is announced to assistive technology and should describe the region's purpose, such as "Primary" versus "Account settings."

Design the Content Flow Inside the Main Region

Within main, arrange content in the order a person should encounter it, and let the visual layout follow that order rather than the reverse. Reading order matters for keyboard users tabbing through controls, for screen reader users, and for anyone on a small screen where columns collapse into a single stack. If the visual design puts a sidebar first but the source order puts it last, the mismatch will surface as confusing focus jumps.

Group related content into section elements with their own headings, and use article for self-contained items such as a product card or a blog post that could stand alone. Lists belong in ul or ol when items are enumerable; a row of navigation links is a list, and marking it as one tells assistive technology how many items to expect. Paragraph text stays in p rather than being broken by br tags, because br conveys a line break, not a paragraph boundary.

For data, use a real table with th cells and a caption when the content is genuinely tabular—rows and columns with shared meaning. Tables used for page layout confuse screen readers and should be replaced with CSS layout. This distinction has been stable for years and remains the correct default.

Make Forms Understandable and Forgiving

Forms are where interface design most often fails, because they combine labeling, validation, error handling, and keyboard behavior. Every input needs a visible, programmatically associated label. Wrapping the input inside the label element or matching the for attribute to the input's id both work, and the visible label text should be the accessible name rather than being replaced by placeholder text. Placeholders disappear on typing and have poor contrast, so they supplement rather than replace labels.

Several principles apply across forms. Group related controls in a fieldset with a legend, which screen readers announce as context. Use the input type that matches the data—email, tel, number, date—so mobile keyboards adapt and browsers offer appropriate validation. Use autocomplete tokens such as email, name, or postal-code so browsers and password managers can fill fields correctly. Mark required fields with the required attribute rather than only an asterisk, and explain any format constraints in text associated through aria-describedby.

Error handling deserves its own design. When validation fails, show a message next to the affected field, move focus to the first error or to an error summary, and ensure the message text explains how to fix the problem rather than merely stating that it is wrong. Announce dynamic errors in a live region so screen reader users hear them without losing their place. Success states should confirm what happened and what comes next.

A reliable way to check form accessibility: tab through the entire form without touching a mouse. Every control should receive visible focus, in a logical order, with its label announced. If focus disappears or lands somewhere unexpected, the markup or CSS is at fault.

Design Navigation and Wayfinding

Navigation answers two questions: where am I, and where can I go? Use a nav element for major navigation groups and mark the current page with aria-current="page" on its link, which assistive technology announces. Keep link text descriptive on its own; "Read more" repeated across a page tells a screen reader user nothing, while "Read the returns policy" does.

For a site with hierarchical sections, a breadcrumb trail built as a list of links helps people locate themselves. For long pages, an in-page table of contents with anchor links to section headings improves scanning. Skip links—a link at the very top that jumps to main—let keyboard users bypass repeated navigation on every page, and they cost almost nothing to implement.

Keep the number of top-level destinations modest. A navigation bar with fifteen equally weighted choices forces users to read all of them; grouping into a few categories with submenus reduces decision load, though submenus must then be operable by keyboard and touch, not hover alone. If a menu opens on hover, provide a click or keyboard equivalent and ensure the submenu closes predictably.

Apply CSS for Layout and Visual Hierarchy Without Breaking Meaning

CSS controls presentation, and the goal is to make the visual hierarchy match the semantic hierarchy. A heading styled small still reads as a heading in the accessibility tree; a div styled to look like a button still is not a button. Keep the two layers aligned by styling the elements you already chose rather than inventing lookalikes.

Modern layout relies on flexbox for one-dimensional arrangement and grid for two-dimensional layout. Both allow the visual order to differ from source order, but reordering with order or grid placement can desynchronize visual and focus order. Use reordering sparingly and verify keyboard order afterward. Responsive design typically starts from a single-column layout and adds columns at wider widths using media queries or container queries, which is simpler and more robust than designing desktop-first and patching phones.

Visual hierarchy comes from size, weight, spacing, and contrast. Body text generally needs a comfortable line length—roughly 45 to 75 characters per line is a common guideline—and generous line height. Color contrast between text and background should meet recognized thresholds; the Web Content Accessibility Guidelines set 4.5:1 for normal text and 3:1 for large text at their AA level, and these figures have been stable across versions. Never use color alone to convey meaning: an error field marked only in red is invisible to someone with color vision deficiency, so pair it with text or an icon.

Focus styles must remain visible. Removing the default outline without replacement is one of the most common accessibility regressions; provide a clearly visible focus indicator using :focus-visible so it appears for keyboard users without cluttering mouse interaction.

Add Interactivity Carefully and Keep Native Behavior

Native HTML elements come with behavior built in: buttons activate with Enter and Space, links activate with Enter, checkboxes toggle, selects open. Reimplementing these with div elements requires reproducing keyboard handling, focus management, and state announcement—work that is easy to get wrong. The first rule of interactive design in HTML is therefore to use the native element that matches the job and style it, rather than building a custom control from scratch.

When you must build a custom widget, follow the established accessibility patterns for that widget type: manage focus, expose state through ARIA attributes such as aria-expanded, and respond to the expected keys. ARIA changes how something is announced, not how it behaves, so attributes alone do not make a widget operable. The often-repeated guidance that no ARIA is better than bad ARIA reflects a real failure mode: incorrect roles and states mislead assistive technology more than plain markup would.

JavaScript should enhance, not gate, core content. A page whose main content requires script to appear is invisible to search engines that do not execute scripts and to users whose script fails. Progressive enhancement—deliver working HTML, then layer behavior—remains a sound default for content sites and forms.

Test With Real Constraints Before Calling It Done

Testing is where design assumptions meet reality. Start with keyboard-only navigation: can you reach every control, see where focus is, and operate every widget? Then test with a screen reader—VoiceOver on macOS and iOS, NVDA or Narrator on Windows are built in or free—and listen to whether labels, headings, and errors make sense without sight. Zoom the page to 200 percent and check that content reflows without horizontal scrolling or clipped text. Check contrast with a color picker against the 4.5:1 and 3:1 thresholds.

Automated tools catch a useful subset of problems—missing labels, low contrast, invalid nesting—but they cannot judge whether a label is meaningful or a flow is logical. Treat their output as a checklist of mechanical issues, then do the human checks.

Performance testing is part of interface design too. Large unoptimized images, render-blocking scripts, and excessive font files all delay the moment a person can use the page. Compress images, specify dimensions to prevent layout shift, and load non-critical scripts asynchronously. Test on a throttled connection and a mid-range phone if you can; a design that only feels fast on a developer laptop is not finished.

Finally, test the states you defined at the start: empty, loading, error, success. Break the network, submit invalid input, and fill lists to realistic lengths. Most interface defects live in states that were never designed, and catching them before release is far cheaper than after.

Common Failure Modes and How to Recognize Them

The same mistakes recur across projects, and each has a recognizable symptom. Div-based buttons fail keyboard activation—pressing Enter does nothing—because the element has no native behavior. Missing or duplicated headings produce a confusing outline that screen reader users cannot skim. Placeholder-only labels vanish on typing and leave users unsure what a field wanted. Layout tables announce meaningless structure. Fixed pixel widths break on narrow screens and with large text. Hover-only menus become unreachable on touch devices and for keyboard users. Color-only error states hide the problem from part of the audience. Focus outlines removed for aesthetics strand keyboard users.

Each symptom points to a specific fix in the markup or CSS rather than a redesign. When something feels wrong during testing, trace it back to the layer responsible: if the meaning is wrong, fix the HTML; if the appearance is wrong, fix the CSS; if behavior is wrong and no native element provides it, add JavaScript with the appropriate accessibility pattern. Keeping that mapping clear is what separates maintainable interfaces from ones that accumulate patches.

A useful stop condition: if a custom interactive component needs behavior beyond what native elements and established ARIA patterns provide, or if the interface must meet a formal accessibility standard for a regulated context, bring in a specialist rather than improvising. Accessibility conformance claims, in particular, require expert evaluation that goes beyond self-testing.

The sequence—task definition, skeleton, semantic structure, forms, navigation, styling, interaction, testing—works because each step constrains the next and each produces a checkable result. Design in HTML is not a matter of picking tags that look right; it is a matter of choosing markup that means what the interface does, then making it look and behave well without breaking that meaning.