让在白色背景上有一个(显示:内联)图像:
<a href="#"><img src="..."></a>
然后我使用 JavaScript 将 IMG 节点替换为 Youtube IFRAME。在加载 Youtube 剪辑时,图像消失并向用户显示一秒钟的白色背景。
问题:我不想要那种深-白-暗的闪烁。
我试图将 A 的背景设置为黑色,但只有一小部分矩形被颜色填充(因为 A 不是 block 元素)。
有没有办法避免眨眼?必须保留元素的内联性质。如果不引入额外的 HTML 元素会更好。
最佳答案
I tried to set A's background to color black, but just a small part of the rectangle was filled with the color (because A is not a block element).
Is there a way to avoid the blinking? The inline nature of the elements must be preserved.
在 a
上尝试 display: inline-block
。
关于javascript - 用不闪烁的 Flash 对象替换图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6880246/