2016-07-25 107 views
0

按照說明在這裏:https://davidwalsh.name/background-animation-cssBootstrap中的響應式動畫背景?

我可以讓圖片移動,但我無法弄清楚如何使其響應。任何想法如何使這成爲可能?我加入以下CSS代碼:

@keyframes animatedBackground{ 
    from {background-position: 0 0;} 
    to {background-position: -1920px 0;} 
} 


#animate-area{ 
    width: 560px; 
    height: 400px; 
    background-image: url("images/japan.jpg"); 
    background-position: 0px 0px; 
    background-repeat: repeat-x; 

    animation: animatedBackground 40s linear infinite; 
} 
+2

你能發佈你的代碼片段嗎? – Pranjal

+0

鑑於你的描述中的網址提供了這樣一個很好的例子。按照演示。比較你的代碼和演示。 – webtuts4u

+0

只需讓你的分區響應。背景將根據此設置。 –

回答

0

在演示中,<div id="animate-area">寬度明確設置爲560像素。嘗試將其設置爲width: auto;。這應該將div寬度縮放到它的容器/父級的寬度。