← Back to list

How to Make Unresponsive iFrames and Ads Responsive with CSS Transform

Third-party embeds — ad tags, iframes, widgets — come with hardcoded width and height attributes you can’t override. CSS width: 100% won’t…

cengiz ilhan in JavaScript in Plain English · 2026-04-28 09:17 · 0 claps · 0.6 min read
#software-development #front-end-development #advertising
Open on Medium ↗
Wiki topics: MKT · Marketing · General 🌐 · Web Development

How to Make Unresponsive iFrames and Ads Responsive with CSS Transform

Third-party embeds — ad tags, iframes, widgets — come with hardcoded width and height attributes you can’t override. CSS width: 100% won’t help — the embed ignores it. The fix: measure the parent container’s width, divide by the embed’s fixed width to get a scale ratio, then apply it via transform: scale(). Since transform is purely visual and doesn’t affect layout, the parent’s height must also be corrected manually to prevent overflow.

Codepen Example:

[embed]How to Make Unresponsive iFrames and Ads Responsive with CSS Transform A code demo by Cengiz ilhan created on CodePencodepen.io


메타데이터
post_id
e4a6508077fa
slug
how-to-make-unresponsive-iframes-and-ads-responsive-with-css-transform-e4a6508077fa
url
https://javascript.plainenglish.io/how-to-make-unresponsive-iframes-and-ads-responsive-with-css-transform-e4a6508077fa
canonical_url
https://javascript.plainenglish.io/how-to-make-unresponsive-iframes-and-ads-responsive-with-css-transform-e4a6508077fa
author_url
https://medium.com/@cngzilhn
status
ok
fetched_at
2026-07-10 23:10:23