我需要调整背景“Image.png”的大小为112 x 22像素,但是当我修改width
和height
时,它会将图像裁剪为所提供的大小而不是调整大小。
我如何调整大小在CSS中的图像?在CSS中调整背景图片大小
#Title-1 {
width: 148px;
height: 29px;
margin-left: 10px;
background-image: url("/pic/Image.png");
display: inline-block;
vertical-align: top;
}
因为您使用图像作为** CSS背景**,而不是内嵌图像(''),请参阅[此参考答案](http://stackoverflow.com/questions/376253/stretch-and-scale-css-background)和CSS属性'background-size'。 –
可能重复[调整图像与CSS成比例?](http://stackoverflow.com/questions/787839/resize-image-proportionally-with-css) –