2015-11-22 59 views
0

無論如何,我在這裏問是否有任何將div轉換爲特定點。我本來試圖翻譯(),才意識到它通過它的偏移增加值轉換一個div:轉換爲特定點css

HTML:

<div class="ttd">I move!</div> 

CSS:

.ttd { 
    -webkit-transition: transform 2s; 
    transform: translate(20px, 20px); 
} 

我試圖讓一個div轉換成一個點,從窗口的頂部和左側sid偏移20px ES。任何人都可以幫助我嗎?此外,這可能在CSS?

回答

0

這將轉化股利爲20px從窗口的頂部和左側偏移:

.ttd { 
 
    position: absolute; 
 
    left: 0px; 
 
    top: 0px; 
 
    -webkit-animation: myAnim 0.5s forwards; 
 
    /*-webkit-animation-delay: 2s;*/ 
 
    animation: myAnim 0.5s forwards; 
 
    /*animation-delay: 2s;*/ 
 
} 
 

 
@-webkit-keyframes myAnim { 
 
    100% { left: 20px; top: 20px; } 
 
} 
 

 
@keyframes myAnim { 
 
    100% { left: 20px; top: 20px; } 
 
}
<div class="ttd">I move!</div>

你可能wan't退房有關CSS過渡和動畫這些有趣的鏈接: