Solution 1: CSS Container Queries with cqmin sounds the best, but unfortunately…
- User
Solution 1: CSS Container Queries with cqminsounds the best, but unfortunatelycontainer-type: size;appliescontain:size, but the elemnets width is dynamic based on the text in it, so it can't use contain size!any other ideas?
Assistant
Here's a modern CSS solution using Anchor Positioning (no pseudo-elements required):
css.container { anchor-name: --self; position: relative; border-radius: calc(anchor(--self height) * 0.5); transition: border-radius 0.3s ease; } .container:hover { border-radius: 0; }How it works:
anchor-name: --selfcreates a self-referential anchor pointanchor(--self height)dynamically reads the container's heightcalc(anchor(...) * 0.5)converts height to radius (50% of height)- Smooth transition to 0 on hover
Browser Support: Works in Chrome 125+ with Anchor Positioning enabled (requires
chrome://flags/#enable-experimental-web-platform-features)If browser support is a concern, here's a viewport-relative fallback that works in modern browsers:
css
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.