TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Feature Matrix Focus

The entire hovered plan column is highlighted in a feature-comparison matrix.

Live Demo

Hover over the element or use Tab to focus.

Source Code

Copy the HTML, CSS or JavaScript you need for your project.

HTML
<div class="tbx-1056"><table><caption>Compare plans</caption><thead><tr><th scope="col">Features</th><th scope="col">Basic</th><th scope="col">Plus</th><th scope="col">Pro</th></tr></thead><tbody><tr><th scope="row">Storage</th><td>5 GB</td><td>50 GB</td><td>1 TB</td></tr><tr><th scope="row">Users</th><td>1 user</td><td>3 users</td><td>Unlimited</td></tr><tr><th scope="row">Support</th><td>─</td><td>○</td><td>◎</td></tr></tbody></table></div>
CSS
.tbx-1056{font:11px/1.4 system-ui;color:#2d465c;width:min(320px,100%);overflow-x:auto}.tbx-1056 table{border-spacing:0;border-collapse:collapse;width:100%;table-layout:fixed}.tbx-1056 caption{text-align:left;font-size:11px;font-weight:700;margin:0 0 7px}.tbx-1056 th,.tbx-1056 td{text-align:center;padding:10px 5px;border-bottom:1px solid #dce6ea;transition:background .16s}.tbx-1056 th:first-child{text-align:left;width:32%}.tbx-1056 thead th{background:#e9f0f3;font-size:10px}.tbx-1056 tbody th{font-size:10px}
.tbx-1056:has(tr>*:nth-child(2):hover) tr>*:nth-child(2),.tbx-1056:has(tr>*:nth-child(3):hover) tr>*:nth-child(3),.tbx-1056:has(tr>*:nth-child(4):hover) tr>*:nth-child(4){background:#d3eeea;color:#135e65}.tbx-1056 tbody tr:hover th:first-child{color:#11717b}.tbx-1056 td:hover{outline:2px solid #4c9897;outline-offset:-2px}
@media(prefers-reduced-motion:reduce){.tbx-1056 th,.tbx-1056 td{transition:none}}

How to Use

Insert the HTML and add the CSS to your stylesheet. Adjust colors and sizes and avoid class conflicts.

Use Case

Useful for comparison sections and pricing pages.

Technical Notes

Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.

Mobile:Ensure the interactive content remains accessible without hover on touch devices.

Browser:Uses modern CSS. Check behavior in the browsers you support.

Reduced Motion:Check that prefers-reduced-motion is respected.