TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Common CSS Pitfalls and How to Avoid Them

2 pointsby philk10almost 2 years ago

1 comment

theandrewbaileyalmost 2 years ago
&gt; By default, a long text will expand the size of its container. But it may make more sense to truncate long text. You can do this simply with, but that will unceremoniously clip text that overflows. You can improve the appearance by ellipsizing, although this is a bit finicky to get working as desired.<p>Or do my favorite: fade to transparent.<p><pre><code> @supports (-webkit-background-clip: text) or (background-clip: text){ element{ background-image: linear-gradient(currentColor, rgb(var(--your-background-color-rgb))); webkit-text-fill-color: transparent; webkit-background-clip: text; background-clip: text; } }</code></pre>