简体   繁体   English

删除iFrame空间时出现问题

[英]Problem removing iFrame space

I have a Facebook iFrame button and a Twitter one. 我有一个Facebook iFrame按钮和一个Twitter按钮。 There is space that automatically comes, I have no idea why, and I can't remove it. 有自动出现的空间,我不知道为什么,也无法删除它。 There is an image of it- 有一个图像-

iFrame问题

There is no <br /> or anything that I know that can cause the space. 没有<br />或我所知道的会造成空间的任何东西。 Thanks in charge. 感谢主管。

Some sample of your HTML output would be helpful, but you could try adding a css rule: HTML输出的一些示例会有所帮助,但是您可以尝试添加css规则:

iframe {
 display: inline-block;
}

EDIT 编辑

Looking at your HTML source, I see you have a width specified on the iFrame elements for the twitter and facebook feeds. 查看您的HTML源代码,我看到您在twitter和facebook feed的iFrame元素上指定了宽度。

<iframe allowTransparency='true' frameborder='0' scrolling='no' src='[LONG URL REMOVED]' style='border:none; overflow:hidden; width:450px; height:20px'></iframe>

If you simply remove the static width from this element, the two frames will sit next to each other. 如果仅从此元素移除静态宽度,则两个框架将彼此相邻放置。 The issue is that the container only has a set amount of width. 问题是容器只有一定的宽度。 If you have 500px total and the twitter iFrame is using 110 of that, the other iFrame wants 450... 450 + 110 = 560, more width than you have available. 如果您总共有500像素,而Twitter iFrame使用的是110像素,则另一个iFrame希望450 ... 450 + 110 = 560,比可用宽度更大。 This forces the Facebook iFrame to wrap to the next line. 这将迫使Facebook iFrame包装到下一行。

So again, just take the static width off the Facebook iFrame. 再次重申一下,只需将静态宽度从Facebook iFrame中移除即可。 As people click "Like", their profile pictures will be added next to the button. 当人们单击“赞”时,他们的个人资料照片将添加到按钮旁边。 Since you won't have a static width specified, the container is free to grow as wide as it needs to. 由于您没有指定静态宽度,因此容器可以根据需要自由增长。

I would also set width:100%; 我还要设置width:100%; on the container div. 在容器div上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM