.portrait-warning
) and use a custom CSS media query @media (orientation: landscape)
to hide it in landscape mode.To show a specific container only on mobile portrait mode in Webflow, you’ll need to use Webflow’s display settings in combination with custom CSS media queries, since Webflow’s built-in visibility controls are limited to device types but not orientation (portrait vs. landscape).
This hides the container on all other device types, but it will still appear on both mobile portrait and landscape, which isn't what you want. So additional targeting is needed.
portrait-warning
.Go to Page Settings (or embed with an Embed element).
Inside the Custom Code section, add the following inside <style>
tags:
Example CSS:
@media (orientation: landscape) { .portrait-warning { display: none !important; } }
This CSS ensures that your container only appears in portrait mode. When the device is in landscape, it’s hidden—even on mobile.
To show a container only in mobile portrait, first use Webflow’s device display settings to hide the container on non-mobile views. Then, use a custom CSS media query targeting orientation: landscape
to hide the container when the phone is rotated, achieving a portrait-only display.