I am using iframes in my page, and have stumbled across a weird issue. I set the iframe css like so
iframe { margin: none; padding: none; background: blue; /* this is just to make the frames easier to see */ border: none; }
However, there is still whitespace surrounding the iframe. I tested it in both Chrome and Firefox, and it's the same. I searched around, and I couldn't find anything. This whitespace doesn't show up in the Chrome console, either. Also, I already have the following CSS as well:
html, body { margin: 0px; padding: 0px; border: 0px; width: 100%; height: 100%; }
JSFiddle: here
1. Remove width="100%" from the iframes. 2. Change align="right" to align="left" on the second iframe if you want them completely side-by-side.
Remove border from iframe tag in the webpage could be done by using one of the CSS properties of the iframe tag called frameBorder and set its value to “0”. Syntax: frameBorder = "value"; Note: In the frameBorder property the B letter must be in capital otherwise it will not be recognized by the browser.
The ” iframe ” tag defines a rectangular region within the document in which the browser can display a separate document, including scrollbars and borders. An inline frame is used to embed another document within the current HTML document. For the fullscreen Iframe, you have to cover the entire viewport.
The HTML Iframe frameborder Attribute is used to specify whether or not to display the border around the content of an <Iframe> Element. Attribute Values: 0: It has a Default value. It sets the border on one state.
Having just seen your fiddle your issue is because you are using display:inline-block
. This takes whitespace in your html into account. display:inline-block
is notorious for being difficult and has dodgy browser support.
Option 1: Try removing the white space in your html can sometimes sort the problem.
Option 2: Using a different display property such as display:block
will definitely sort the problem. Live example: http://jsfiddle.net/mM6AB/3/
When you are using an inline element, the whitespace might be from the "line" the element is part of (ie. the space below the baseline). The solution then is to add this to its parent element.
line-height: 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With