css 在浏览器之间不显示相同的 <a> 标签

标签 css

我有一个显示多个链接的页面。当我在 Chrome 中查看时,我看到了我想要的内容:链接显示为灰色且没有下划线,悬停时链接变为黑色。但是当我在 firefox 或 IE9 中查看时,所有链接都是蓝色或紫色的,并且都带有下划线。悬停时颜色不会改变。

我做错了什么?为什么链接在所有浏览器中显示的不同?我希望链接与 chrome 中的链接相同。

CSS:

a:link {color: #008000; text-decoration: none} 
a:visited {color: #cccccc; text-decoration: none}
a:active {color: #ff0000; text-decoration: underlined}
a:hover {color: #606060; text-decoration: underlined}

我的文档类型声明:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">

最佳答案

带下划线 对属性text-decoration 无效。您正在寻找 underline

a:link {color: #008000; text-decoration: none;}
a:visited {color: #cccccc; text-decoration: none;}
a:active {color: #ff0000; text-decoration: underline;}
a:hover {color: #606060; text-decoration: underline;}

JSFiddle

关于css 在浏览器之间不显示相同的 <a> 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10166024/

相关文章:

javascript - 炫耀无法站出来的内容

html - 在双头表的 Bootstrap 中居中 <th>

javascript - 当使用 PHP include 时切换按钮不起作用

css - 为 Top 10 帖子添加数字

php - 如何在 PHP 中获取想要的格式

javascript - 物化CSS : How to Toggle 2 Notifications When Pressing One button (On and Off)

html - Buycraft::从左边保持之前

适用于 iPad 的 Javascript IDE

jquery Accordion 函数添加和删除类,没有任何反应

HTML/CSS - 给 li 类