问题描述react的jsx中backgroundSize不能使用,如何做才能达到同样的效果,固定宽高,图片宽度100%,高度超出隐藏,这样图片就不会变形相关代码 <div style={{ background: `url("${head}")`,
backgroundRepeat:"no-repeat", width: "3.75rem", height: "3rem",
backgroundSize:"cover"
}}></div>
1 回答
ITMISS
TA贡献1871条经验 获得超8个赞
background-size放进background里。background: [background-color] [background-image] [background-repeat] [background-attachment] [background-position] / [ background-size] [background-origin] [background-clip]
添加回答
举报
0/150
提交
取消