【问题标题】:CSS : a:visited not showing properly by Safari and FirefoxCSS : a:visited 在 Safari 和 Firefox 中未正确显示
【发布时间】:2014-09-23 21:49:35
【问题描述】:

我为链接设置了下面的 CSS。此代码生成此..

在 Firefox 中:链接为灰色、焦点和悬停为白色,但访问后不会变成粉红色。

在 Safari 中:链接为灰色,焦点和悬停为白色,访问时变为粉红色,但在刷新/清空缓存/重置 safari 后不会重置回灰色。

a {
  display: block;
  text-decoration: none;
  font-weight: normal;
}           
a:link {
  color: grey;
}
a:visited {
  text-decoration: none;
  color: pink;
}
a:focus {
  color: white;
}
a:active, 
a:hover {
  text-decoration: none;
  color: white;
}

请帮忙?

【问题讨论】:

    标签: css firefox safari


    【解决方案1】:

    编辑:

    在 Firefox 中,转到工具 -> 选项 -> 内容(选项卡)-> 颜色-> 并选中“允许页面选择自己的颜色”。这应该可以让您看到您的 CSS 访问过的颜色。

    可能没有使用正确的顺序:

    a:link
    a:visited
    a:hover
    a:active
    a:focus
    

    这样排列您的代码:

    a {
      display: block;
      text-decoration: none;
      font-weight: normal;
    }           
    a:link {
      color: grey;
    }
    a:visited {
      text-decoration: none;
      color: pink;
    }
    a:hover,
    a:active {
      text-decoration: none;
      color: white;
    }
    a:focus {
      color: white;
    }
    

    【讨论】:

    • 编辑了我的答案以包含对首选项的更改:在 Firefox 中,转到工具 -> 选项 -> 内容(选项卡)-> 颜色-> 并选中“允许页面选择自己的颜色”。这应该可以让你看到你的 CSS 访问过的颜色。
    • 刚刚检查,它已经设置为“允许页面选择自己的颜色”。
    猜你喜欢
    • 2016-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-03
    • 2018-10-31
    • 1970-01-01
    • 2010-10-29
    相关资源
    最近更新 更多