37 ms·
TIL that in certain browsers you can play a video in an <img> element ... and that disappoints me because I always thought <img> was supposed to be used for sta
by rikroots 4y ago
TIL that in certain browsers you can play a video in an <img> element ... and that disappoints me because I always thought <img> was supposed to be used for static images, while <video>, <svg> and <canvas> elements were more appropriate for animated images.
The CSS Painting API[1] looks like it will "allows web content authors to use videos as a CSS background-image", so developers will be able to add videos (via the API's restricted 2D canvas implementation) as background images to any (block-like?) HTML display element. The API isn't - yet - supported across browsers[2]. Of course, the Painting API is not as simple as Safari's solution.
None of this addresses the accessibility issues, as others have pointed out.
[1] - https://developer.mozilla.org/en-US/docs/Web/API/CSS_Painting_API https://developer.mozilla.org/en-US/docs/Web/API/CSS_Paintin...
[2] - https://caniuse.com/css-paint-api https://caniuse.com/css-paint-api