我有一個透明的背景圖像,我想爲它的背景添加灰色,我做到了,但是我無法擴展它的寬度以達到整個頁面的寬度(換句話說,我無法改變它的大小即使在使用背景大小的屬性之後)。爲什麼我無法增加添加到圖像的背景大小?
img{
height:40px;
width:40px;
background-color:rgb(0, 0, 0);
background-size:100px 100px;
}
<img src="https://www.google.co.in/search?espv=2&biw=1366&bih=662&tbm=isch&sa=1&q=html+logo+transparent+background&oq=html+logo+tra&gs_l=img.1.1.0j0i30k1.3420.4038.0.5941.4.4.0.0.0.0.302.302.3-1.1.0....0...1c.1.64.img..3.1.301.xRQ23nL94iw#imgrc=FkYJhNmbMb325M%3A" align="center">
背景圖像,因爲你的元素的寬度/高度僅爲'40x X 40px' – Dekel