White space is still present around the iframe bor

2019-06-16 19:40发布

Even After setting the frameborder attribute in the iframe to 0 there is still some white space present around the iframe border (unlike the original url/link page). Is there any other way to get rid of the white space or some white must be presented around the iframe as it is within the webpage (or part of it) and it cannot be the whole page? Thank you.

8条回答
混吃等死
2楼-- · 2019-06-16 19:51

Frederic's proposal solved my problem: howto get rid off the white border in a fullscreen slideshow for safari browser. Perfect! Many thanks, wimsch [Since I couldn't add a comment on his answer [[< 50]]: I put it here to let him know my gratitude]

查看更多
Animai°情兽
3楼-- · 2019-06-16 19:54

Simply add style="margin: 0 0 0 0" inside <iframe > tag.

example:

<iframe src="http://www.yahoo.com" style="margin: 0 0 0 0"></iframe>

If you want margin, you must add 'px' after number

(Thanks to "Inspect Element" tool of Safari Browser) this solved my solution.

查看更多
对你真心纯属浪费
4楼-- · 2019-06-16 19:58

I ran into a similar problem: I had the iframe inside a figure tag, and there was some white space between the iframe and the figcaption element.

<figure>
  <iframe></iframe>
  <!-- white space was here -->
  <figcaption></figcaption>
</figure>

In my case simply adding iframe { display:block } solved the issue.

查看更多
放荡不羁爱自由
5楼-- · 2019-06-16 20:00

Apply below to iframe

display: block
查看更多
ゆ 、 Hurt°
6楼-- · 2019-06-16 20:01

Maybe that whitespace is actually the outside margin of the document loaded in the <iframe>. Try styling the loaded document with:

html, body {
    border: 0px;
    margin: 0px;
    padding: 0px;
}
查看更多
放我归山
7楼-- · 2019-06-16 20:03

try this

<iframe src="....." style="position:absolute;"></iframe>
查看更多
登录 后发表回答