여기 내 코드가 있습니다. 사용자가 링크를 클릭하면 div 태그에 배경 이미지를 표시하려고합니다. 하지만 내 배경 이미지가 화면에 맞지 않습니다 (아래 그림과 같이 CSS의 높이와 너비를두면 적어도 전체 이미지를 표시 할 수 있지만 화면 밖으로 나갈 것입니다). CSS에서 height 및 width 속성을 제거하면 이미지가 전혀 표시되지 않습니다.화면에 맞지 않는 div의 배경 이미지
HTML ->
<body>
<div>
<ul>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2012'">IT Spend</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2012'">Assessments</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2012'">Information</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2012'">2012</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2013'">2013</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2014'">2014</a></li>
<li><a href="#none" onclick="document.getElementById('wrapper').className ='IT_Spend_2015'">2015</a></li>
</div>
<div id="wrapper" class="IT_Spend_2012"'></div>
</body>
css->
#wrapper { background-repeat: no-repeat; width:1500px; height:1100px;}
.IT_Spend_2012 { background-image: url('./img/IT_Spend2012.jpg'); }
.IT_Spend_2013 { background-image: url('./img/IT_Spend2013.jpg'); }
.IT_Spend_2014 { background-image: url('./img/IT_Spend2014.jpg'); }
.IT_Spend_2015 { background-image: url('./img/IT_Spend2015.jpg'); }
배경 위치 : 왼쪽 상단; background-repeat : no-repeat; background-size : auto; 또는 수동으로 크기를 지정할 수 있습니다. (내가) – VikingBlooded