需要帮助调试css失败的原因

时间:2010-07-16 10:54:04

标签: css

我有像

这样的标记

显示here

我想知道为什么它看起来像12行& 13

.notes:link span,
.notes:visited span { ...

似乎正在运作

.comments span,
background-position: -16px -16px;
}
.permalink:link span,
.permalink:visited span {
background-position: -32px -16px;
}

似乎不存在

由于某种原因,cssdesk似乎在下面的案例代码中... ...

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
    .notes:link span,
    .notes:visited span, 
    .comments span,
    .permalink:link span,
    .permalink:visited span {
      background: url("http://static.tumblr.com/ikeq9mi/F6Tl4vrjj/metasprite.jpg") no-repeat;
      padding-right: 16px; /* width */
      font-size: 15px; /* height */
      margin: 0 2px;
      position: relative;
      top: -1px;
    }
    .notes:link span,
    .notes:visited span {
      background-position: 0 -16px;
    }
    .comments span,
      background-position: -16px -16px;
    }
    .permalink:link span, 
    .permalink:visited span {
      background-position: -32px -16px;
    }
    .notes:hover span,
    .notes:active span {
      background-position: 0 0;
    }
    .comments span,
      background-position: -16px 0;
    }
    .permalink:hover span,
    .permalink:active span {
      background-position: -32px 0;
    }
    </style>
</head>
<body>
<a href="{Permalink}#notes" class="notes" title="notes">{NoteCount}<span></span></a> / 
<span class="comments">
  <a href="{Permalink}#disqus_thread" class="dsq-comment-count" title="comments">Comments</a>
  <span></span>
</span> / 
<a href="{Permalink}" class="permalink" title="permalink"><span></span></a>
</body>
</html>

2 个答案:

答案 0 :(得分:5)

我认为你应该

.comments span {
    background-position: -16px -16px;
}

而不是

.comments span,
    background-position: -16px -16px;
}

答案 1 :(得分:0)

嗯,你发布的CSS是不正确的,你缺少一个左大括号,这样的事情会导致浏览器中的解析不一致。

.comments span,
background-position: -16px -16px;
}

应该是

.comments span {
background-position: -16px -16px;
}