2015-11-05 82 views
1
img.resize{ 
    width:200px; 
    height: auto; 
} 

<img class="img-circle" src="portfolio picture.png"> 

CSS和html代碼都是。仍然不會調整大小。無法在css和html中調整圖像大小

+0

它不會因爲CL工作屁股對IMG是「IMG圈」,它不符合你的CSS「調整大小」 – partypete25

+0

[CSS顯示圖像調整大小和裁剪]可能的副本(http://stackoverflow.com/questions/493296/css-display -an圖像調整大小和裁剪) – LearningProcess

回答

0

這裏是控制規模,同時仍保持比例的最佳方式:

#your-img { 
    height: auto; 
    width: auto; 
    max-width: 300px; 
    max-height: 300px; 
} 
0

確保類名在你的CSS規則 使用的名稱匹配,並確保該路徑圖像(以src是正確的)。

否則,您使用的是正確的屬性,請參閱下面的工作示例,其中我將300px寬的圖像的大小調整爲200px,同時保持圖像的高寬比。

img.resize { 
 
    width: 200px; 
 
    height: auto; 
 
}
<img class="resize" src="http://placehold.it/300x150">

0

你沒有類.resize那就是你的形象,你的東西與類調整大小,但圖像上的唯一一類寫作風格是「IMG-圈」

.img-circle{ 
width:200px; 
height: auto; 
} 
<img class="img-circle" src="portfolio picture.png"> 

或:

img.resize{ 
width:200px; 
height: auto; 
} 
<img class="resize" src="portfolio picture.png">