0

Let there is a (display:inline) image on a white background:

<a href="#"><img src="..."></a>

Then I replace the IMG node with an Youtube IFRAME using JavaScript. The image disappears and the white background is shown to user for a second while the Youtube clip is being loaded.

The problem: I don't want that dark-white-dark blinking.

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. It's better if no additional HTML elements would be introduced.

Pavel Vlasov
  • 3,940
  • 6
  • 37
  • 53

1 Answers1

1

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.

Try display: inline-block on the a.

thirtydot
  • 217,782
  • 47
  • 385
  • 346
  • You're welcome. If you happen to still support IE6/7, see: http://stackoverflow.com/questions/5838454/inline-block-doesnt-work-in-internet-explorer-7-6/5838575#5838575 – thirtydot Jul 30 '11 at 00:29