我想将图像的宽度和高度增加到实际的 3 倍,但我不知道图像的尺寸。我可以使用 CSS 来实现吗?
我尝试了 calc()
函数,但它不接受 auto
。
最佳答案
你可以在你的风格中使用这个 %
<img src="yourimage.jpg" style ="width:300%; height:300%">
或
<img src="yourimage.jpg" alt="Smiley face" height="300%" width="300%">
或者你可以使用这个
<img src="yourimage.jpg" alt="Smiley face" class="image-class">
<style>
.image-class {
transform:scale(3,3);
}
</style>
关于html - 将图像宽度增加到自动宽度的 x 倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45145687/