I’m probably a bit late to the game here. However I’ve recently been building a site that required iPhone X app screenshots to a device mockup. Previously this had been very simple with the past generation of iPhone’s as they all had rectangular screens.

For previous sites I had simply added in the iPhone mockup and then used position absolute to align the screen on the device.

Some may upload the mockup with the screenshot already present however we like to give our clients the option to upload their own screenshot should their app change.

The Problem

So the biggest factor to overcome was the notch on the iPhone X. I could take the app screenshot and cut out the notch in Photoshop. However this isn’t easily done by clients.

The Solution

The best method that I’ve found to combat the notch is to use CSS Clipping Masks. According to Can I Use, global usage of browsers that support this feautre is at 84.95% so that’s a good proportion of web users but we should still incorporate a fallback.

So here’s the HTML:

And the CSS:

Fallback

Notice there’s a border-radius in the css before the supports, this fallback will round the corners of the screenshot so browsers that don’t support CSS Mask will still see the screenshot in the phone however it won’t have the notch cut out. Otherwise they would see square edges.

The Result

Download Links

iPhone X Mockup: http://madebyfalcon.co.uk/wp-content/uploads/2018/01/iphone-x.png

Screen Cutout SVG: http://madebyfalcon.co.uk/wp-content/uploads/2018/01/iphone-cutout.svg