On the large screen, the player looks well-suited. On a narrow screen, however, it extends beyond the article content or leaves an impractically high blank space. In such cases, the website container that holds the player often needs to be adjusted. Simply replacing the video file is not automatically the solution.
This article examines the size of the embedding on the website. Whether padding margins are already included in the recording is a separate issue. For a functional mobile layout, the available width, frame height, and embedded content must first match correctly.
The space comes from the website block
A browser width of 390 CSS pixels is not fully available for the video. Page margins, columns, and a visible scroll bar can shrink the content area. A fixed iframe width of, for example, 640 pixels will then not fit without additional layout rules.
An iframe embeds a separate document. Your website controls its outer frame; the embedded player manages its own content. This boundary is important: a CSS rule on your site can modify the frame without overriding the internal player styles.
First, check the service's intended embedding code. If it already includes a responsive wrapper, use that structure. Adding an extra, generic wrapper can introduce additional height constraints and unexpected spacing. Furthermore, the website CMS must use a block that actually accepts and processes the required code.
A concrete example of a custom iframe
Our local example uses a surrounding container with the class "atlas-embed". Inside this container is the iframe. The outer container receives the available width and aspect ratio. The iframe then fills this calculated frame.
The two related CSS rules in the example are:
.atlas-embed { width: 100%; aspect-ratio: 16 / 9; }
.atlas-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
This is a standalone general layout template. Take the actual player URL and its required attributes from the embed code provided by the intended provider. Do not replace it with a standard video page if the provider requests a specific embedding URL.
MDN explains that "aspect-ratio" influences the automatic size calculation. If both width and height are already explicitly defined, an additional aspect ratio does not simply override those definitions. Therefore, when a discrepancy is observed, check the actually effective CSS rules on the container and the iframe, including any fixed heights set by the theme.
Intentionally limited tall format
For a widescreen format, our example replaces the aspect ratio with 9/16 and adds "max-width: 240px". The width stays bound to the available space using "width: 100%", but never exceeds the specified upper limit. This is a design choice made for this particular test, not a general rule applicable to all widescreen video formats.
On a very wide article page, an unrestricted 9:16 aspect ratio would be extremely tall. Choose an appropriate upper limit based on the content and desired reading flow. Additionally, ensure that captions and control elements are clearly visible within the actual player. A mathematically correct aspect ratio alone does not constitute a complete usability proof.
What the personal Chrome test showed
On October 22, 2026, we tested two of our own iframe contents with synthetic videos in Chrome 155 on Windows. The actual viewport widths measured 320, 390, and 768 CSS pixels. The existing browser zoom level was preserved; scrollbars and the actual element boundaries were measured.
The 16:9 frame had approximately the following dimensions in this side layout:
- At a viewport width of 320 CSS pixels: 274 by 154 CSS pixels.
- At a viewport width of 390 CSS pixels: 344 by 194 CSS pixels.
- At a viewport width of 768 CSS pixels: 723 by 406 CSS pixels.
The rounded values refer to our specific layout setup with margin spacing and desktop scrollbars. They are not target specifications for your website. The aspect ratio was preserved; in all three final measurements, the page width was not increased due to horizontal overflow. The landscape frame remained at approximately 240 by 427 CSS pixels.
This was a size check of our own content using a desktop browser. Real touch devices, other browsers, and a third-party hosting player were not tested. Therefore, for your specific use case, an additional check on the intended devices and on the actual published website is recommended.
Separating frame problems from image cropping
"object-fit: contain" can fully fit a video element within its container area. "cover" may crop parts of the video when the aspect ratio differs. However, according to MDN, "object-fit" does not apply to the content inside an external iframe. Therefore, applying such a rule to an iframe is not a reliable way to embed a foreign player inside.
If the article's frame remains correctly positioned but the player shows no image content, check the player's own rendering and its source. If, instead, the entire player extends beyond the page, first examine the surrounding container and effective widths. This allows you to identify and adjust the layer where the issue actually occurs.
Review the completed page
Open the published website in both a narrow and a wide view. Look for side overflow, inappropriate white spaces, and cut-off interactive elements. Start the video intentionally and verify key captions. Then test on an actual target device, rather than reproducing a smartphone view using a desktop layout.
Vioneto's original guidance requires, after confirmed sharing and acceptance of the code, that you also test the content yourself as a viewer. Standard editorial or website editing is not the appropriate context for this. A suitable framework is achieved when your specific content remains clear and user-friendly within the intended width.
MDN: Aspect ratio and automatic sizing
MDN: the outer iframe and its document
MDN: Effects and limitations of object-fit