Categories
CSS

How to apply CSS to iframe?

Spread the love

Sometimes, we want to apply CSS to iframe.

In this article, we’ll look at how to apply CSS to iframe.

How to apply CSS to iframe?

To apply CSS to iframe, we set the style attribute.

For instance, we write

<iframe
  name="iframe1"
  id="iframe1"
  src="empty.htm"
  frameborder="0"
  border="0"
  cellspacing="0"
  style="border-style: none; width: 100%; height: 120px"
></iframe>

to add the style attribute with the styles for the iframe.

Conclusion

To apply CSS to iframe, we set the style attribute.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *