怎么弄这个CSS?

来源:百度知道 编辑:UC知道 时间:2024/05/28 14:15:29
A:hover { background: red;}

A:link { background: black;}

A:visited {background: red; }
这三行出现这样的问题,当访问过一个链接后,再次在链接上面时就不会有变化,要怎么让它即访问过后还是像第一次一样的效果,(不可删除A:visited)因为不想让IE默认显示红的

CSS中用四个伪类来定义链接的样式,分别是:a:link、a:visited、a:hover和a : active,例如:

a:link{font-weight : bold ;text-decoration : none ;color : #c00 ;}
a:visited {font-weight : bold ;text-decoration : none ;color : #c30 ;}
a:hover {font-weight : bold ;text-decoration : underline ;color : #f60 ;}
a:active {font-weight : bold ;text-decoration : none ;color : #F90 ;}
以上语句分别定义了"链接、已访问过的链接、鼠标停在上方时、点下鼠标时"的样式。注意,必须按以上顺序写,否则显示可能和你预想的不一样。记住它们的顺序是“LVHA”。

试试
A{background: black;}
A:hover { background: red;}

在VS里右键 最下面大纲显示 切换所有大纲显示 和 折叠到定义 你试试

A{background: black;text-decoration:none;}
A:hover{text-decoration:underline;}
A:hover,A:visited{ background: red;}

试试这个