2016-12-29 6 views
0

車のホイールをクリックする必要がありますので、車は100px進みます。この場合のホイールは「後」ですが、 ":after:active"セレクタでは動作しませんが、他のセレクタでは動作します。どうすれば修正できますか?2つの擬似セレクタがそれぞれCSS #idで動作しませんでした:after:active {}

PS:私はクロムを使用しています。

#Car{ 
height: 30%; 
width: 30%; 
background-color: blue; 
position:relative; 
bottom:20%; 
left: 30%; 
top:-40%; 
border-top-right-radius : 20% 30%; 
border-bottom-right-radius : 20% 30%;} 

#Car:after{ 
content:""; 
height: 50%; 
width: 20%; 
position: absolute; 
left: 50%; 
top:90%; 
border-radius: 50%; 
background: #cc7b0f; 
border: 10px solid grey; 
z-index:6; 
} 

#Car:after:active{ 
transform: translate(100px, 0px); 
transition:ease-in-out; 
} 

答えて

1

あなたのセレクタCar:after:activeを意味するもの

:after element that is :active should have rules{*translate*} 

ですが、あなたがここで必要なのは

です
#Car that is :active has :after element which should have rules{*translate*} 

ので、あなたは

#Car:active:after 
+0

スーパーにあなたのセレクタを変更する必要があります!ありがとうございます –

+0

ただ1つの問題、ホイールだけが動いていて、車全体ではありません –

+0

あなたはそのためのコードスニペットを作成して、あなたが使っている完全なhtml/cssを追加できますか? – godblessstrawberry

関連する問題