Responsive Tables That Keep the Data Understandable
A table can fit a phone without losing its headers or relationships. Choose scrolling, column priority or a separate detail view based on the comparison the reader actually needs.

A wide comparison table arrives in the design and somebody adds overflow hidden. The layout looks tidy. Half the values disappear. That is not responsive design; it is data deletion by CSS.
Tables exist because relationships matter. The reader compares values down a column or across a row. On a narrow screen, your job is to preserve that comparison as far as possible, not simply to make every cell fit inside the viewport.
Identify the real comparison
Ask what readers are trying to decide. A hosting comparison may need provider, monthly cost, storage and backup policy visible together. A transaction history may only need date, status and amount until a row is opened.
If every column is essential to comparison, horizontal scrolling is often more honest than converting the table into dozens of unrelated blocks. If only a few columns matter most of the time, expose them first and put the remaining details behind a clear row-level action.
Do not hide columns solely because a designer dislikes the width. Record what moves, where it moves, and how somebody using a keyboard or screen reader can still find it.
Start with semantic HTML
Use a table, caption, header cells and appropriate header relationships. A grid of div elements can look identical while losing the information assistive technology needs to describe a value.
<section aria-labelledby=class="text-code-string">"plans-heading">
<h2 id=class="text-code-string">"plans-heading">Hosting plan comparison</h2>
<div class=class="text-code-string">"table-scroll" role=class="text-code-string">"region"
aria-labelledby=class="text-code-string">"plans-heading" tabindex=class="text-code-string">"0">
<table>
<caption>Illustrative plan limits; prices exclude tax</caption>
<thead>
<tr>
<th scope=class="text-code-string">"col">Plan</th>
<th scope=class="text-code-string">"col">Storage</th>
<th scope=class="text-code-string">"col">Monthly price</th>
</tr>
</thead>
<tbody>
<tr>
<th scope=class="text-code-string">"row">Starter</th>
<td>20 GB</td>
<td>Example: USD 12</td>
</tr>
</tbody>
</table>
</div>
</section>The example has one row to show structure, not to propose a real offer. Complex multi-level headers may need explicit id and headers associations instead of relying only on scope. Test the announcement with the assistive technologies your audience uses.
Give overflow somewhere to go
A scroll wrapper can preserve the table's natural layout. Make it focusable when keyboard users need to scroll it, give it an accessible name and provide a visible focus indicator. Avoid adding dozens of named regions to a page when ordinary table navigation already works.
.table-scroll {
max-inline-size: 100%;
overflow-x: auto;
}
.table-scroll:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: 3px;
}
table {
inline-size: 100%;
border-collapse: collapse;
}
th, td {
padding: 0.75rem;
text-align: start;
vertical-align: top;
}Use project tokens for the focus colour. A grid or flex parent may also need min-inline-size: 0 so the wrapper can shrink rather than forcing the entire document wide. Test the containing layout, not the table in isolation.
Let descriptions wrap. Preserve no-wrap for short, genuinely indivisible values such as a compact date or amount, not every column. Breaking a long URL or identifier deliberately is better than making it define the width of the whole page.
Be cautious with stacked rows
The common mobile transformation makes every cell a block and inserts its heading with a pseudo-element. It can work visually but can also lose table semantics in some browser and screen-reader combinations. Generated content is not a substitute for robust header associations.
If you need a separate mobile summary, keep its values generated from the same data model and test for duplicate announcements. Do not maintain a manually copied second dataset. The first edited price will expose that mistake.
Stacked summaries are useful when a row is a record to inspect. They are less useful when someone must compare eight plans by five attributes. In that case, prioritised columns plus scrolling usually preserve the task better.
Make sorting understandable
Put the sort control inside the relevant header and apply aria-sort to the currently sorted header cell. Update its value when direction changes. A decorative up-arrow does not communicate the sorted state on its own.
Sort raw values rather than display strings. Currency text sorts lexicographically; "USD 100" can land before "USD 20." Keep a numeric value and currency code in the data model, then format for display.
If sorting changes focus or moves the reader unexpectedly, fix that interaction. Announce a concise result when needed, such as the new ordering, without reading the entire table after every click. Keep row actions stable and clearly associated with their row.
Sticky columns need a budget
A sticky first column can help identify the current row during horizontal scrolling. On a small phone it can also consume most of the viewport. Constrain its width and test long names, zoom and translated labels.
Sticky headers and columns need opaque themed backgrounds and deliberate layering so scrolling text does not show through them. Check borders and focus outlines at their intersections. Avoid making the page header and table header together consume the entire screen height.
Test with inconvenient content
Use long provider names, missing values, negative balances, large numbers and several currencies. Distinguish zero from unavailable data. Test at a narrow width and at increased browser zoom, with a keyboard and a screen reader.
Verify that horizontal scrolling belongs to the table region, not the entire document. Check that a row's detail action still exposes hidden information and that printing does not clip important columns.
The best mobile table is not always the narrowest one. It is the one that keeps relationships intact, makes any compromise visible and lets the reader finish the comparison they came to make.
Paj Digital Labs
The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.
Related reading

International Websites: Locale URLs, Hreflang and Formatting Without Guesswork
Language, country and formatting are related but different choices. Give translated pages stable URLs, preserve user selection and keep search signals aligned with real equivalents.

Progressive Enhancement for Article Sites: The Page Should Outlive Its Scripts
Core reading and navigation should remain available when hydration or a third-party script fails. Start with useful HTML and layer interactions without turning every link into an application dependency.

Website Search That Finds Answers: Ranking, Typos and Empty Results
Search quality depends on the documents and ranking rules, not the size of the input box. Index useful fields, handle imperfect queries and give readers a way forward when nothing matches.