Menu Close

How to apply CSS to iframe?

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.

Posted in CSS