我想在CSS中做一個快速動畫,我很難做到這一點。當我將鼠標懸停在圖像上時,其目標是將圖像滑動到左側。我哪裏錯了?我收到「對不起,規則@ -webkit關鍵幀未實現。」在validator.org這裏是CSS和HTML代碼。沒有產生任何動畫效果的關鍵幀
CSS:
body {
background-color:#d9d6cb;
}
#title {
font-family:Agency FB;
text-shadow:5px 0px 3px gray;
text-align:center;
}
#mygallery{
width:580px;
padding:20px;
margin-left: auto;
margin-right: auto;
background:black;
}
#fullimage
{
list-style:none;
width:580px;
height:400px;
margin:0;
padding:0;
overflow:hidden;
}
#thumbimage
{
list-style:none;
overflow:auto;
float:right;
margin-left:5px;
border-color:white;
opacity:.5;
}
#thumbimage:hover{
opacity:1;
-webkit-animation: slideImage 1s;
animation: slideImage 1s;
}
@-webkit-keyframes slideImage{
0%:{left:-700px;}
100%{left:0px;}
}
HTML:
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Index</title>
<link rel="stylesheet" type="text/css" href="Gallery/CSS/style.css">
</head>
<body>
<h1 id="title"> Image Gallery </h1>
<div id="mygallery">
<ul id="fullimage">
<li>
<img id="house" src="Gallery/Images/House.jpg" alt="House" width="580">
<p><span> House </span>
</p>
</li>
<li>
<img id="tree" src="Gallery/Images/tree.jpg" alt="Tree" width="580">
<p><span> Tree </span>
</p>
</li>
<li>
<img id="hobbithole" src="Gallery/Images/HobbitHole.jpg" alt="Hobbit Hole" width="580">
<p><span> Hobbit Hole </span>
</p>
</li>
<li>
<img id="horses" src="Gallery/Images/horses.jpg" alt="Horses" width="580">
<p><span> Horses </span>
</p>
</li>
</ul>
<ul id="thumbimage">
<li><a href="Gallery/Images/House.jpg"><img src ="Gallery/Images/House.jpg" alt = "House" width = "50"></a>
</li>
<li><a href="Gallery/Images/tree.jpg"><img src ="Gallery/Images/tree.jpg" alt = "tree" width = "50"></a>
</li>
<li><a href="Gallery/Images/HobbitHole.jpg"><img src ="Gallery/Images/HobbitHole.jpg" alt = "Hobbit Hole" width = "50"></a>
</li>
<li><a href="Gallery/Images/horses.jpg"><img src ="Gallery/Images/horses.jpg" alt = "horses" width = "50"></a>
</li>
</ul>
</div>
</body>
你能做出的jsfiddle?您的HTML結構也很重要 – Raptor 2014-10-10 06:55:42
在類'thumbimage'上增加位置或將'left:-700px'更改爲'margin-left' – 2014-10-10 07:18:02
在'0%:{left:-700px;}'似乎存在拼寫錯誤。那裏不需要':'。 – Harry 2014-10-10 07:22:00