Home > Back-end >  Problem with removing white padding edges on iframe
Problem with removing white padding edges on iframe

Time:08-24

I have a problem with removing the white border on the edge of an iframe. In this html code, I have a button that sends you to a blank tab when clicked.

I have made multiple attempts to remove the white padding edges. Here is the base code without me trying to remove the padding; https://jsfiddle.net/4dchkyqt/

Some of the code I tried adding to fix it; iframe.style.margin = "none"; and iframe.style.padding = "0".

CodePudding user response:

The white border is on the page that holds the iFrame - You need to set it's body attribute of margin: 0; -

For example, add win.document.body.style.margin = '0'; in your script before you append the iFrame to the document

  • Related