How to get an IFrame to be responsive in iOS Safari with CSS?

Spread the love

Sometimes, we want to get an IFrame to be responsive in iOS Safari with CSS.

In this article, we’ll look at how to get an IFrame to be responsive in iOS Safari with CSS.

How to get an IFrame to be responsive in iOS Safari with CSS?

To get an IFrame to be responsive in iOS Safari with CSS, we disable scrolling on the iframe.

For instance, we write

<iframe height="950" width="100%" scrolling="no" src="Content.html"></iframe>

to set the scrolling attribute to no to disable scrolling on the iframe.

Then we write

iframe {
  width: 1px;
  min-width: 100%;
}

to set the width of the iframe to be responsive.

Conclusion

To get an IFrame to be responsive in iOS Safari with CSS, we disable scrolling on the iframe.

Leave a Reply

Your email address will not be published.