这两天,在看CSS,看的是圣思园的视频。里面对样式的优先级是这样说的:
一般来说所有样式有下面的规则(以下优先级由低至高)
1.Browser default
浏览器默认
2.External style sheet
外部样式表
3.Internal style sheet (inside the <head> tag)
内嵌样式表
4.Inline style ( inside an HTML element)
行内样式
在学到后面时,对链接定义它的样式。我的代码如下:
HTML代码:
<html>
<head>
<link rel="stylesheet" type="text/css" href="test4.css"/>
</head>
<body>
<p><a href="">This is a link.</a><br>
<a href="">This is really a link.</a></p>
</body>
</html>
CSS代码:
body { color:orange}
h1 { color:green; font-size: 20pt}
hr { color: red}
p { font-size: 11pt; margin-left: 15px}
a:link { color: blue}
a:visited {color: red}
a:hover { color: black}
a:active { color: green}
但是在搜狗浏览器IE内核能如正常显示,在webkit内核及firefox浏览器中,链接均是显示红色。难道仅是IE才支持link么?
2011-08-26 18:32:31补充:明白了。看到后面知道了,因为链接的网站不是我没有访问过的,所以在firefox中显示的是访问过的颜色。看来IE和其他浏览器内核还是有很大不同啊。