Menu

Fixing a hero text/image overlap with one media query (and how to measure it)
📰

Fixing a hero text/image overlap with one media query (and how to measure it)

DEV Community: css·Ansy Group·3 days ago
#22V8hGdM
#devtocss#devto#dev#hero#phone
Long article (864 words) — no AI summary yet.
Reading 0:00
15s threshold

Our landing page hero had a classic desktop bug: a large gradient headline ("...on Telegram and your website") was wrapping to one line thanks to white-space: nowrap and sliding underneath a floating phone mockup positioned absolutely on the right. At 1280px the word "website" visually collided with the phone frame, and a caption chip under the phone was clipped off the left edge.

The fix took ten minutes once we stopped reaching for z-index . This is the write-up, because the actual root cause was an old media query, not the new layout.

The setup (simplified)

<section class = "hero" > <div class = "hero-copy" > <h1> Automate customer chats on <span class = "grad" > Telegram and your website </span></h1> </div> <div class = "hero-visual" > <div class = "phone" > ... </div> <div class = "fc fc3" > EN interface language </div> </div> </section>

Enter fullscreen mode

Exit fullscreen mode

.hero h1 .grad { white-space : nowrap ; /* keeps the gradient phrase on one line */ background : linear-gradient ( ...…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.