影响元素填充的 Flash/SWF 对象

发布于 2024-08-07 13:20:37 字数 405 浏览 5 评论 0原文

我一直在绞尽脑汁试图解决这个问题,因为这在我工作过的过去几个网站上都是一个问题(尽管它们还没有上线),而不是试图建立一个解决方案喜欢尝试发现问题的根源。

这是有问题的网站:(URL 已删除)

基本上,我将此主页编码为纯 HTML,然后随着时间的推移完成它们,然后插入 JavaScript 和 Flash 元素。当我开始添加 Flash(使用 SWF 对象)时,我注意到它已将其下方的元素向下推了大约 5 像素,并且仅在 Firefox 和 Safari 中(奇怪的是,Internet Explorer 不受影响)。关闭 Flash 或禁用 JavaScript(这也会关闭 Flash)会删除此额外的填充。

有人可以告诉我是什么原因导致了这个问题吗?我没有注意到任何主要的 JS 或 CSS 错误(除了 IE 的一些 hack),所以我很困惑。

I've been racking my brain trying to figure this one out as it's been a problem on the past few sites I've worked on (though they haven't gone live yet) and rather than trying to rig up a solution I'd like to try and discover the root of the problem.

Here's the site in question: (URL removed)

Basically I coded this homepage out as plain HTML and then inserted JavaScript and Flash elements as I completed them over time. When I got to adding the Flash (using SWF Object), I noticed that it had pushed the elements beneath it down roughly 5px, and only in Firefox and Safari (Internet Explorer, oddly enough, isn't affected). Turning off Flash or disabling JavaScript, which also turns the Flash off, removes this extra padding.

Can someone enlighten me as to what is causing this issue? I don't notice any major JS or CSS errors (other than a few hacks for IE), so I'm stumped.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

森末i 2024-08-14 13:20:37

尝试将 line-height:0; 添加到 flash-swf 周围的 div:

<div id="flashDiv" style="line-height:0;">

这对我有用。

Try to add line-height:0; to the div around the flash-swf:

<div id="flashDiv" style="line-height:0;">

This worked for me.

把梦留给海 2024-08-14 13:20:37

尝试删除页面上 DIV 之间的空白,并尝试将 swf 对象放入其自己的 DIV 中。这样您就可以在不加载 swf 的情况下控制页面的外观,并且加载时不会影响其他元素。

Try removing the whitespace between the DIVs on the page, and try putting the swf object into its own DIV. That way you can control what the page looks like without loading the swf, and it won't affect the other elements when it loads.

空城旧梦 2024-08-14 13:20:37

尝试将对象元素的边距和填充显式设置为 0px

您使用的是 SWFObject 2.0,它的功能与旧版 SWFObject 略有不同。旧的会将嵌入内容植入目标 div 的内部。新的似乎实际上用对象标签替换了整个目标 DIV。

有些东西我不喜欢,这就是为什么我仍然使用旧的 SWFObject。

Try explicitly setting the margin and padding of the object element to 0px

You're using SWFObject 2.0, which does things slightly differently than the SWFObject of old. The old one would plant the embed INSIDE of a target div. The new one seems to actually replace the entire target DIV with an object tag.

Something I don't like, which is why I still use the old SWFObject.

自控 2024-08-14 13:20:37

SWFObject 插入一个 元素。一些浏览器将 视为作为内联元素,有些将其视为块级元素。

解决方法是使用 CSS 确保对象始终被视为块级元素:

object { display: block; }

请参阅有关该主题的 SWFObject 常见问题解答。

SWFObject inserts an <object> element. Some browsers treat <object> as an inline element, some treat it as a block-level element.

The fix is to use CSS to ensure that objects are always treated as block-level elements:

object { display: block; }

See the SWFObject FAQ on the subject.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文