简体   繁体   English

具有base64图像的背景图像样式

[英]Background-image style with base64 image

I'm trying to append img to div tag (not img tag), however when I try this not works. 我正在尝试将img附加到div标签(而不是img标签),但是当我尝试这样做时不起作用。

  srcs[1] = "data:image/png;base64, iVBORw0KGgoAAAA..."

  <div style={{ background: `url(${srcs[1]})center/cover no-repeat` }} />

Any ideas? 有任何想法吗?

我会评估者使用div.background,而不是决定将img.src与object-fit: scale-down;一起使用object-fit: scale-down;

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

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