Skip to content

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
The photograph the phone was measured from, laid over it
Look at
Show

The CSS that draws it

Device.tsx
as rendered
  1. .phone {
  2. aspect-ratio: 454 / 951;
  3. border-radius: 17.79cqw;
  4. }

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.