我有一个 200px*200px <img>
在<button>
在我的页面上。如果我使用 CSS 缩小图像:
img{
width:50%;
height:50%;
}
,按钮仍然很大,就好像图像仍然是全尺寸的。
有什么解决办法吗?
谢谢。
最佳答案
试试这个:
img {
width: 50%;
height: auto;
}
<button>
<img src="https://www.google.co.uk/images/srpr/logo11w.png" />
</button>
关于html - 按钮不缩小图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32422067/