CSS iPhone
An iPhone drawn in CSS to frame my app demos.
A case study needed a phone to hold its screens, and a photo would be blurry or heavy. So I drew it: rails, chamfers, antenna bands and the island are all gradients, every value off one photograph.
css iphone
Look at
Show
The CSS that draws it
Device.tsx
as rendered- .phone {
- aspect-ratio: 454 / 951;
- border-radius: 17.79cqw;
- }
What it is
The phone frame around the screens in my BeFT case study, drawn entirely in CSS with no images.
Why I needed it
A phone image would look blurry, and a sharp enough one would slow the page down. The camera island also has to sit on top of the screen, which meant cutting an image mockup apart.
How I did it
I built it with Claude Code from one photo of a real phone, matching its colours and curves pixel by pixel. The edges, buttons and camera island are all CSS gradients.
