2011-10-13 2 views

답변

1

은 다음과 CSS를 시도>http://jsfiddle.net/Pq67x/1/ 여기

<style> 
    div { 
     width:50px; 
     height:100px; 
    } 

    div img { 
     height:100%; 
     width: 100%; 
     max-width:100%; 
     max-height:100%; 
    } 
</style> 
<div> 
    <img src='path/to/img.gif' /> 
</div> 
1

당신은 갈 : http://jsfiddle.net/chricholson/8Xer3/. 그래도 이미지 왜곡됩니다 : http://jsfiddle.net/chricholson/8Xer3/1/. 또한 div와 함께 다른 작업을 수행하지 않는 한 기본적으로 div가 필요하지 않습니다. http://jsfiddle.net/chricholson/8Xer3/2/.

HTML :

<table> 
    <tr> 
     <td> 

      <img src="http://imgsrc.hubblesite.org/hu/db/images/hs-2001-24-a-web.jpg" /> 

     </td> 
    </tr> 
</table> 

CSS :

td { 
    width: 400px; 
    height: 600px; 
    background: yellow; 
} 

img { 
    height: 100%; 
    width: 100%; 
} 
관련 문제