<div>
要素内で上下に「スクロール」する大きな画像を配置したい。問題は、画像のサイズが#animation-win
div 要素のサイズに引き伸ばされることです。画像の高さが 300px を超えているため、300px の div 要素内に元のサイズで表示できるように上下にスクロールする必要があります。それはできますか?どうもありがとうございました。
これはhtmlです:
<div id="animation-win">
<div class="anim">
</div>
</div>
これは私のCSSです:
#animation-win {
background:#000;
position: relative;
width:900px;
height:300px;
}
.anim
{
background-image:url('../images/picture1.jpg');
background-size: 100% 100%;
position:absolute;
animation:cssanim 5s infinite;
animation-direction:alternate;
/* Safari and Chrome */
-webkit-animation:cssanim 5s infinite;
-webkit-animation-direction:alternate;
}
@keyframes cssanim
{
0% {background:red; left:0px; top:0px;}
100% {background:red; left:0px; top:0px;}
}
@-webkit-keyframes cssanim /* Safari and Chrome */
{
0%{
background-image:url('../images/picture1.jpg');
width:100%;
height:100%;
left:0px;
top:0px;
background-size: 100% 100%;
}
100% {
background-image:url('../images/picture1.jpg');
width:100%;
height:100%;
left:0px;
bottom:549px;
background-size: 100% 100%;
}
}