這是一個簡單的學校項目網站。我在主頁的圖像滑塊上遇到了CSS動畫問題。它拒絕生成動畫,並且與瀏覽器網站檢查員進行檢查,結果顯示該規則未被「計算」(應用於)圖像。CSS 3動畫無法在任何瀏覽器中使用
下面是頁面的代碼:
<!DOCTYPE html>
<head>
<title>Foo Bar Lorem Ipsum IS-3 | Home</title>
<link rel="stylesheet" href="stylesheets\home.css">
</head>
<body>
<div id="wrapper">
<header>
<div id="navbar">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div>
<img src="images\header.png">
<header>
<div class="slider">
<ul>
<li><img src="images\law1.JPG" width="900" height="675" title="SLC Law
Workshop"/> </li>
<li><img src="images\law2.JPG" width="900" height="675" title="SLC Law
Workshop"/> </li>
<li><img src="images\law3.JPG" width="900" height="675" title="SLC Law
Workshop"/> </li>
<li><img src="images\blood1.JPG" width="900" height="675" title="SLC Blood
Drive "/> </li>
<li><img src="images\blood2.JPG" width="900" height="675" title="SLC Blood
Drive"/> </li>
<li><img src="images\blood3.JPG" width="900" height="675" title="SLC Blood
Drive"/> </li>
<li><img src="images\interview1.JPG" width="900" height="675" title="SLC
Interview"/> </li>
<li><img src="images\interview3.JPG" width="900" height="675" title="SLC
Interview"/> </li>
<li><img src="images\interview4.JPG" width="900" height="675" title="SLC
Interview"/> </li>
</ul>
</div>
</header>
<div id="main">
<h1>
Welcome to the Foo Website
</h1>
<hr />
<p>
Welcome to the Foo
</p>
<p>
Lorem Ipsum
</p>
<p>
Hello World
</p>
</div>
</body>
</html>
而對於CSS:
body
{
background-image:url("../images/bg.png");
}
@font-face
{
font-family: Interstate;
src:url("../fonts/Interstate.ttf");
}
#wrapper
{
position:relative;
margin:auto;
width:900px;
background-color:#fcfcfc;
}
#wrapper header img
{
display:block;
margin-left:auto;
margin-right:auto;
}
#navbar
{
position:fixed;
}
#navbar ul
{
list-style-type:none;
margin:0;
padding:0;
}
#navbar li
{
display:inline;
float:left;
}
#navbar a
{
display:block;
width:225px;
font-family:Interstate, Segoe UI, sans-serif;
text-align:center;
}
#navbar a:hover
{
}
#main
{
margin-left:auto;
margin-right:auto;
padding:0;
}
#main h1
{
font-family:Interstate, Segoe UI;
text-align:center;
color:#6f273d;
}
#main p
{
font-family:Interstate, Segoe UI, sans-serif;
text-align:justify;
margin-left:8px;
margin-right:8px;
}
#main hr
{
color:#6f273d;
background-color:#6f273d;
}
header .slider
{
overflow:hidden;
}
header .slider ul
{
width:8100px;
margin:0;
padding:0;
position:auto;
cursor:arrow;
animation: slide 15s;
animation-duration:15s;
animation-iteration-count:infinite;
animation-timing-function:ease-out;
}
header .slider ul:hover
{
animation-play-state:paused;
}
header .slider ul li
{
list-style:none;
float:left;
margin:0;
position:relative
}
@keyframes "slide"
{
0%
{
left:0;
}
11%
{
left:-900px;
}
22%
{
left:-1800px;
}
33%
{
left:-2700px;
}
44%
{
left:-3600px;
}
55%
{
left:-4500px;
}
66%
{
left:-5400px;
}
77%
{
left:-6300px;
}
88%
{
left:-7200px;
}
100%
{
left:0;
}
}
我穿過W3s CSS和HTML驗證整個CSS和HTML文件跑,但沒有骰子。他們不顯示任何錯誤。有人能幫忙嗎?
輝煌!因此這些供應商特定的前綴必須應用於每個動畫屬性,例如-o-animation-play-state,-moz-animation-play-state,等等等等? – asu74
是的,exaclty。大多數css3的東西都需要前綴(到目前爲止,這可能會改變) –
好吧,我爲每個動畫屬性添加了每個供應商的前綴,但是我仍然無法將其設置爲動畫。檢查每個瀏覽器的站點檢查器會一直顯示沒有爲圖像滑塊計算規則。有什麼我錯過了嗎? – asu74