# Safe Areas and Notches: Using env(safe-area-inset-*)

> How to keep content clear of notches, camera cutouts and the home indicator with viewport-fit=cover and env(safe-area-inset-*), with ready CSS.

Canonical: https://ihatebugs.dev/guides/safe-area-insets-notch
Last updated: 2026-10-17

Updated 2026-10-17.

**By default, mobile browsers keep your page inside the safe area, so notches and rounded corners don't cover it. If you opt into drawing edge to edge with `viewport-fit=cover`, you must pad the edges yourself with `env(safe-area-inset-top)`, `-right`, `-bottom` and `-left`, which report how much of each edge is covered by a notch, camera cutout, rounded corner or the home indicator.**

## When you need it

You only need safe-area insets if the page draws to the very edges:

- a full-bleed header or background colour that should reach behind the notch,
- a fixed bottom bar that must sit above the home indicator,
- landscape layouts, where the notch moves to the left or right edge.

Without `viewport-fit=cover`, the browser letterboxes the page into the safe area and the insets are zero.

## Step 1: opt in

```html
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
```

## Step 2: pad the edges

```css
.site-header {
  padding-top: env(safe-area-inset-top);
}

.bottom-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.page {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
```

`max()` keeps your normal spacing on devices without a notch, where the inset is `0`, and grows it where the cutout is bigger ([MDN](https://developer.mozilla.org/docs/Web/CSS/env)).

## Which devices it affects

- **Notch and Dynamic Island iPhones** report a top inset in portrait and side insets in landscape, plus a bottom inset for the home indicator. Examples: [iPhone 14](https://ihatebugs.dev/devices/iphone-14) (notch) and [iPhone 16 Pro](https://ihatebugs.dev/devices/iphone-16-pro) (island).
- **Android phones** with a punch-hole camera report a cutout inset when the page is drawn edge to edge, for example the [Pixel 9](https://ihatebugs.dev/devices/pixel-9).
- **Phones with bezels**, such as the [iPhone SE (3rd gen)](https://ihatebugs.dev/devices/iphone-se-3), report zero.

## Test it

Rotate to landscape on a notch iPhone: that is where left and right insets matter and where most bugs hide. The [Mobile Simulator](https://ihatebugs.dev/mobile-simulator) draws generic notch, island and punch-hole frames so you can see how close content runs to each cutout; confirm the final spacing on a real phone, because only the device reports the real inset values.
