Floorplan Room Spotlight
Hovering over a floor-plan room highlights its name and area within a property card.
Hovering over a floor-plan room highlights its name and area within a property card.
Live Demo
Hover over the element or use Tab to focus.
Source Code
Copy the HTML, CSS or JavaScript you need for your project.
<div class="tbx-1272"><div class="listing"><div class="heading"><b>APT. 07</b><span>2LDK / 67.8m²</span></div><div class="plan"><button class="room living" type="button"><span>Living</span><small>20.4 m²</small></button><button class="room bedroom" type="button"><span>Bedroom</span><small>12.6 m²</small></button><button class="room study" type="button"><span>Study</span><small>7.8 m²</small></button><div class="hall">ENTRANCE →</div></div></div></div>
.tbx-1272{width:100%;min-height:218px;box-sizing:border-box;display:grid;place-items:center;padding:16px;background:#f0efe9;font-family:system-ui,sans-serif;color:#39433d}.tbx-1272 *{box-sizing:border-box}
.tbx-1272 .listing{background:#fff;width:min(320px,100%);padding:13px;border:1px solid #d0cec3;box-shadow:0 8px 20px #3e4e3e18}.tbx-1272 .heading{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e3e2da;padding-bottom:9px;margin-bottom:9px;gap:8px;font-size:11px}.tbx-1272 .heading b{letter-spacing:.16em}.tbx-1272 .heading span{font-size:9px;color:#89938c}
.tbx-1272 .plan{display:grid;grid-template-columns:1.1fr .85fr;grid-template-rows:80px 60px 20px;gap:3px;background:#8b938b;border:3px solid #748478}.tbx-1272 .room{display:flex;align-items:flex-start;justify-content:center;flex-direction:column;text-align:left;gap:2px;background:#edf2eb;border:0;cursor:pointer;color:#47614e;padding:11px;font:600 11px system-ui;min-width:0;position:relative;transition:background .35s,color .35s}
.tbx-1272 .room small{font-size:9px;color:inherit;opacity:0;transform:translateY(5px);transition:transform .35s,opacity .35s}.tbx-1272 .living{grid-row:span 2}.tbx-1272 .study{background:#dce6d9}.tbx-1272 .hall{grid-column:span 2;display:grid;place-items:center;background:#d8ded3;font-size:8px;letter-spacing:.17em;color:#647366}
.tbx-1272 .room:is(:hover,:focus-visible){background:#55745d;color:white}.tbx-1272 .room:is(:hover,:focus-visible) small{opacity:1;transform:none}.tbx-1272 :focus-visible{outline:3px solid #d68d55;outline-offset:-4px}
@media(prefers-reduced-motion:reduce){.tbx-1272 *{transition:none!important}}
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 real estate sections and property sections.
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.