I've come across an issue lately with my web design projects that has been insignificant enough to slip through my fingers unfixed a few times, but it's just gotten too annoying.

我最近遇到了一个问题,我的网页设计项目已经很不重要了,它会在我的手指间滑动几次,但它太烦人了。

Say I have a style sheet with these rules:

假设我有一个带有这些规则的样式表:

a {
    outline: 0;
    text-decoration: underline;
}

a:link {
    color: #0099FF;
}

a:visited {
    color: #0099FF;
}

a:hover {
    color: #FFFF00;
}

a:active {
    color: #33FF66;
}

Links in my document will only sometimes have the correct colors, but sometimes they will just be the default blue->purple links. I'm on a black background, so these look awful.

我的文档中的链接有时会有正确的颜色,但有时它们只是默认的蓝色->紫色链接。我的背景是黑色的,所以看起来很糟糕。

If I refresh the page, about half the time they will render correctly. This is happening in both Firefox and Chrome.

如果我刷新页面,大约一半的时间他们会正确渲染。这在Firefox和Chrome中都有发生。

What's going on?

这是怎么呢

3 个解决方案

#1


4

If you are currently developing your css, it is very possible that the browsers have a cached version of the wrong version of the style sheet, which would explain why your links don't display correctly.

如果你正在开发你的css,很可能浏览器有一个错误版本的样式表的缓存版本,这将解释为什么你的链接没有正确显示。

Try the following : In your link to the css, add a query string with garbage values. This will force the re-download of the css and see if your rules apply consistently. If they do, then you know it is a caching problem. Leave the query string as is and your users will re-download the css. If not, then you have a css problem. Download firebug for firefox, check one of the links that doesn't display the right color and see what rules apply to it.

尝试以下步骤:在您的css链接中,添加一个带有垃圾值的查询字符串。这将强制重新下载css,看看您的规则是否一致适用。如果他们这样做了,那么您就知道这是一个缓存问题。保留查询字符串,您的用户将重新下载css。如果没有,那么就会出现css问题。为firefox下载firebug,检查一个没有显示正确颜色的链接,看看有哪些规则适用于它。

Here is how you would add the query string :

下面是如何添加查询字符串:

<link rel="stylesheet" type="text/css" href="style.css?v=3">

更多相关文章

  1. js去掉html标签和去掉字符串文本的所有的空格
  2. 在HTML / PHP联系表单上出现404/405错误(链接问题?)
  3. 在京东上6-24日购买6台笔记本7天无理由 退货 退不了 把订单编号
  4. QQ、MSN、淘包旺旺、Skype常设对话的html链接代码
  5. 帮助相对路径链接到本地​​文件
  6. 在页面重新加载时添加活动链接和jquery幻灯片切换到自定义ajax w
  7. knitr html输出中的字符串太长
  8. 如何将这些Twitter bootstrap 3导航栏链接集中在一起?
  9. 从数组中构建越来越长的字符串

随机推荐

  1. 如何使用XSL来显示XML数据的详解
  2. 简单介绍XML技术概要
  3. 详解如何使用XMLHTTP发送超长XML表单数据
  4. 具体分析微软的xml解析器
  5. 使用XSL和ASP在线编辑XML文档的代码详解
  6. XmlHttp异步获取网站数据的代码案例分析
  7. xml中应用领域的示例代码分享
  8. 如何使用XMLHTTP制作域名查询系统的代码
  9. 详细介绍XML中名字空间的代码案例
  10. 使用用XML和XSL生成动态页面的代码详解