HTML:
<div id="shoppingcart">
<img src="assets/images/cart.png" alt="">
</div>
CSS:
#shoppingcart img { width: 16%; height: 16%; }`
我尝试了我所知道的一切,从创建类、其他id、div到将代码更改为width或max-width。我只是不知道该怎么办了。
你能更好地解释你遇到的问题吗?代码运行良好。
#shoppingcart img{
width:16%;
height:20vh;
}
<div id="shoppingcart">
<img src="http://via.placeholder.com/640x360" alt="">
</div>