safe-area-handling

Configure safe-area insets for Capacitor apps on iOS and Android.

58|5|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/Cap-go/capgo-skills --skill safe-area-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-area-handling
Source: https://github.com/Cap-go/capgo-skills/tree/main/skills/safe-area-handling
Command: npx skills add https://github.com/Cap-go/capgo-skills --skill safe-area-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Safe areas on modern devices can obscure content; this guide provides strategies to ensure UI respects notches, Dynamic Island, home indicators, and Android cutouts. This Skill covers CSS, JavaScript, and native configurations to consistently render edge-to-edge layouts across iOS and Android devices.

Core Features & Use Cases

  • Viewport and CSS: Enable safe-area insets with viewport-fit=cover and env(safe-area-inset-*) variables to pad content appropriately.
  • Cross-platform guidance: Apply consistent patterns in CSS, TS/JS utilities, and native iOS/Android tweaks to support notches and display cutouts.
  • Real-world use case: Implement a header and content layout that remains visible and accessible on iPhone with a notch or Dynamic Island and on Android devices with display cutouts.

Quick Start

Add the viewport-fit=cover meta tag and use env(safe-area-inset-*) values in your CSS to respect notches and home indicators.

Frequently Asked Questions about safe-area-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle safe-area insets in a Capacitor app to prevent content from being obscured by notches?

To handle safe-area insets in a Capacitor app, you need to add a viewport meta tag with viewport-fit=cover and apply the CSS env(safe-area-inset-*) variables to pad your content. This ensures UI elements remain visible on devices with notches or home indicators.

What is the CSS env() function and how does it work with viewport-fit for mobile layouts?

The CSS env() function accesses environment variables like safe-area-inset-top to apply dynamic padding. When combined with viewport-fit=cover in the viewport meta tag, it allows your web layout to extend edge-to-edge while avoiding obscured content on iOS and Android devices.

Does this safe-area handling approach support both iOS Dynamic Island and Android display cutouts?

Yes, this safe-area handling approach supports both iOS and Android projects. It provides cross-platform guidance using CSS, JavaScript utilities, and native configuration tweaks to consistently respect iOS Dynamic Island, home indicators, and Android display cutouts.

How do I implement a header layout that respects the Dynamic Island and home indicators using CSS?

Implementing a header layout that respects Dynamic Island and home indicators requires setting viewport-fit=cover in your HTML and applying padding using env(safe-area-inset-top) and env(safe-area-inset-bottom) CSS variables to prevent the header content from being obscured.

Why does my edge-to-edge content overlap the notch even after adding safe-area CSS variables?

Edge-to-edge content overlaps the notch when the viewport meta tag lacks viewport-fit=cover. Without this setting, the browser does not expose the env(safe-area-inset-*) values, preventing your CSS from calculating the required padding to avoid obscured UI elements.

Do I need native configuration tweaks for iOS and Android to handle safe areas correctly?

While viewport-fit=cover and CSS env() variables handle most safe-area layout issues, optional native iOS and Android tweaks are provided to ensure consistent edge-to-edge rendering. These native configurations address specific device behaviors like notches and display cutouts.