To tell the browser to use the whole available space on the screen, and so enabling us to use the env() variables, we need to add a new viewport meta value:
This is especially important for devices with notches, rounded corners, or home indicator bars (like iPhones with Face ID). Without viewport-fit=cover, your content may not extend into these areas, wasting valuable screen space.
You can then use env() in your CSS to respect the device's safe areas:
The inputmode attribute provides a hint about the type of data that might be entered by the user while editing the element or its contents. This allows the browser to display an appropriate virtual keyboard, improving usability for forms and inputs.
The enterkeyhint attribute defines what action label (or icon) to present for the enter key on virtual keyboards. This can improve the user experience by making the keyboard's action button context-aware.
On mobile browsers, the viewport height can change as the browser UI (address bar, toolbars) appears or disappears. Traditional vh units can cause layout jumps. CSS now provides dynamic viewport units:
dvh (dynamic viewport height): Always reflects the current viewport height, even as UI changes.
svh (small viewport height): The smallest possible viewport (e.g., when browser UI is visible).
lvh (large viewport height): The largest possible viewport (e.g., when browser UI is hidden).
playsinline is a Boolean attribute indicating that the video is to be played "inline", that is, within the element's playback area. On mobile browsers, especially iOS Safari, the default is to play videos fullscreen. Adding playsinline allows the video to play within the page, enabling custom controls, overlays, or seamless integration with other content.
Tip: Combine with muted and autoplay for silent, auto-playing inline videos:
Use the touch-action CSS property to control how touch interactions are handled. This can prevent unwanted scrolling or zooming on interactive elements.
Example:
.button { touch-action: manipulation;}
On mobile, double-tapping can zoom the page, which may be undesirable for buttons or controls. Prevent this by setting:
Enhancing the mobile web experience involves a combination of viewport management, input optimization, media handling, and touch interaction improvements. By leveraging these modern HTML and CSS features, you can deliver a smoother, more native-like experience for your users.