2017-02-11 44 views
1

我是新的CSS動畫。當我將鼠標懸停在塊上時,我正在進行轉換。但是當我徘徊在它上面時,沒有任何反應webkit-transition在Chrome中不起作用

<!--HTML--> 
    <div class="pageTwo"> 
    <div class="block-works"> 
    <p class="work">We at Good Tree production watch movies at full time.Watching movies at 24 X 7 is our duties and reviewing them is our homework </p> 
    </div> 
</div> 

CSS:

.block-works{ 
    position:absolute; 
    background-color: black; 
     opacity: 0.8; 
     padding-right: auto; 
     display:block; 
    width:90%; 
    margin-top: 100px; 
    margin-bottom:100px; 
    margin-left: 5%; 
    margin-right: 5%; 
    border-radius: 7px; 
    height: 200px; 
    -webkit-transition: width 2s; 
    transition: width 2s 
} 
.blockworks:hover{ 
    width:90%; 
    transition-delay: 0.6s; 
} 
+0

我相信你'.blockworks:hover'選擇實際上應該寫成'.blockworks:懸停「中間有一道短跑。 –

回答

1

檢查這個代碼希望它幫助。

#HTML 

    <div class="pageTwo"> 
     <div class="block-works"> 
     <p class="work">We at Good Tree production watch movies at full time.Watching movies at 24 X 7 is our duties and reviewing them is our homework </p> 
     </div> 
    </div> 

#CSS 
    .block-works{ 
     position:relative; 
     background-color: black; 
      opacity: 0.8; 
      padding-right: auto; 
      display:block; 
     width:90%; 
     margin-top: 100px; 
     margin-bottom:100px; 
     margin-left: 5%; 
     margin-right: 5%; 
     border-radius: 7px; 
     height: 200px; 
     -webkit-transition: width 2s; 
     transition: width 2s 
    } 
    .block-works:hover{ 
     width:100px; 
     transition-delay: 0.6s; 
    } 
+0

https://jsfiddle.net/hqa57pux/工作代碼 –

0

我評論了我在CSS代碼段已經改變

.block-works{ 
 
    position:absolute; 
 
    background-color: black; 
 
     opacity: 0.8; 
 
     padding-right: auto; 
 
     display:block; 
 
    width:40%; /* initial width changed to show animation */ 
 
    margin-top: 100px; 
 
    margin-bottom:100px; 
 
    margin-left: 5%; 
 
    margin-right: 5%; 
 
    border-radius: 7px; 
 
    height: 200px; 
 
    transition: width 2s 
 
} 
 
.block-works:hover{ /* name of class changed */ 
 
    width:90%; 
 
    transition-delay: 0.6s; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width"> 
 
    <title>JS Bin</title> 
 
</head> 
 
<body> 
 
    <!--HTML--> 
 
    <div class="pageTwo"> 
 
    <div class="block-works"> 
 
    <p class="work">We at Good Tree production watch movies at full time.Watching movies at 24 X 7 is our duties and reviewing them is our homework </p> 
 
    </div> 
 
</div> 
 
</body> 
 
</html>

相關問題