這很有趣,因爲我真的找不到任何事情在網上,真的爲什麼我的代碼拋出一個分析錯誤。下面的代碼顯示我有一個媒體查詢,基本上改變了一些元素及其屬性。CSS驗證器拋出解析錯誤與CSS動畫媒體查詢
當我驗證此代碼時,由於游泳動畫,它會拋出解析錯誤,當我刪除此動畫並重新驗證它通過的代碼時沒有任何問題。
這可以修復或只是可以忽略的東西:)?
@media (max-width: 1325px) {
#chapter-one-background, #chapter-two-background, #chapter-three-background {
height: 450px; }
#sound-button {
width: 21px; }
.buttonCenter {
padding: 50px 0px 20px 0px;}
html {
font-size: 1em; }
h1 {
font-size: 3em; }
h2 {
font-size: 2.027em; }
h3 {
font-size: 1.199em; }
h4 {
font-size: 1em; }
.button-wrapper {
padding-top: 50px; }
.button-wrapper .buttons img {
max-width: 90%; }
.exchange-list img {
max-width: 20%; }
.exchange-list .list-float-right {
width: 230px; }
.article-center {
width: 300px; }
.article-info {
width: 350px; }
.article-info img:last-child {
width: 100%; }
#cloud-background {
padding: 2% 2% 4% 2%; }
.article-center-video {
width: 400px; }
.article-center-video .article-info-video {
width: 400px; }
.eyes-container {
margin-top: 280px; }
.sun {
top: -300px; }
#cowhead1 {
top: 100px;
left: 100px; }
#cowhead1 img {
width: 90px; }
#hands-behind-left {
height: 663px; }
#chapter-four-background-left {
height: 663px; }
#cowhead2 {
top: 100px;
left: 180px; }
#cowhead2 img {
width: 90px; }
#info2-chapter3 {
padding-top: 80px; }
#exchange-chapter3 {
padding-top: 90px;
left: 15%; }
#info1-chapter3 {
padding-top: 110px; }
#chapter-four-background-right {
width: 250px; }
@keyframes swim {
0% {
-webkit-transform: translateX(0px);
-moz-transform: translateX(0px);
-ms-transform: translateX(0px);
-o-transform: translateX(0px);
transform: translateX(0px); }
50% {
-webkit-transform: translateX(500px);
-moz-transform: translateX(500px);
-ms-transform: translateX(500px);
-o-transform: translateX(500px);
transform: translateX(500px); }
100% {
-webkit-transform: translateX(1000px);
-moz-transform: translateX(1000px);
-ms-transform: translateX(1000px);
-o-transform: translateX(1000px);
transform: translateX(1000px); } } }
驗證使用瀏覽器前綴會或多或少總是拋出的錯誤,因爲這基本上是無效的代碼,那些你可以忽略的。你得到什麼錯誤代碼? – LGSon
是的,前綴不是我知道的問題,但當上面的代碼在CSS驗證器中運行時,我得到了一個解析錯誤。如果我將Swim關鍵幀移到代碼底部,它將完美驗證。 我猜測它與媒體查詢中的關鍵幀有關。 – Mayo
是的,正確的,將_keyframes_規則移到_media query_ – LGSon