【问题标题】:Visited link color changes访问过的链接颜色变化
【发布时间】:2010-10-11 02:06:05
【问题描述】:

我有这门课:

.news_item_info 
{
    font-size: .7em; 
    color:#000000; 
    text-indent: 30px;
    a:link { color: #000000; }
    a:visited { color: #000000; }   
}

这里有代码:

<div class="news_item_info">
    <?php echo $articles[$index]->getPoints(); ?> puntos por <span class="news_item_user"><a href="/index.php?action=user&param=<?php echo $articles[$index]->getUsername(); ?>">
    <?php echo $articles[$index]->getUsername(); ?></a> </span>
    <?php echo $articles[$index]->getElapsedDateTime(); ?> | <span class="comments_count"><a href="<?php echo "/index.php?action=comments&param=".$articles[$index]->getId(); ?>"><?php echo $articles[$index]->getNumberOfComments($articles[$index]->getId()); ?> comentarios</a></span>
</div>

问题是,在我访问用户个人资料后,它显示为灰色,我想保持黑色。

如果有人知道答案,我将不胜感激。

【问题讨论】:

  • 即使你不能用 CSS 做到这一点,如果你能做到,那就太酷了。
  • @Paolo:你可以用 CSS 做到这一点,只是语法不同。

标签: php html css


【解决方案1】:

发布的 CSS 无效,您必须通过级联定义来限定样式。尝试像这样取消嵌套链接定义:

.news_item_info 
{
    font-size: .7em; 
    color:#000000; 
    text-indent: 30px;       
}

.news_item_info a:link { color: #000000; }
.news_item_info a:visited { color: #000000; }

【讨论】:

    【解决方案2】:

    你不能那样做 CSS(嵌套块)。

    .news_item_info 
    {
        font-size: .7em; 
        color:#000000; 
        text-indent: 30px;
    }
    
    .news_item_info a:link { color: #000000; }
    .news_item_info a:visited { color: #000000; }       
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-03
      • 2013-01-02
      • 1970-01-01
      • 2016-11-26
      • 2013-01-04
      • 1970-01-01
      • 2010-12-28
      • 2015-02-10
      相关资源
      最近更新 更多