您的位置:首页 > Web前端 > CSS

CSS基础学习5-CSS设置链接

2016-10-20 10:09 197 查看
所有CSS基础学习文档下载地址:http://download.csdn.net/detail/rongrong_love_lc/9663463

五、CSS设置链接
通过伪类(pseudo-class)来控制链接是未访问、已访问、活动的、是否有鼠标悬停等不同的属性;
之前的修改颜色,字体,添加下划线都可以用到链接上。
在HTML中链接是通过a元素来定义的,因此CSS中,我们可以将a作为一个选择器(selector):
value:a:link[未访问过的]、a:visited[已访问过的]、a:activite[活动的]、a:hover[有鼠标悬停的].
html文件如下:
<html>
<head>
<title>Color例子</title>
<link rel="stylesheet" type="text/css" href="color.css"/>
</head>
<body>
<p>study测试文本信息study</p>
<h1><a href="https://www.baidu.com">百度一下</a></h1>
<h2><a href="https://www.sogou.com">https://www.sogou.com</a></h2>
<h3><a href="http://translate.google.cn">http://translate.google.cn</a></h3>
<h4><a href="http://fanyi.youdao.com">http://fanyi.youdao.com</a></h4>
</body>
</html>
CSS文件如下:
body {background:white url("image1.jpg") no-repeat fixed center;
}
p {text-align:justify;
letter-spacing:5px;
text-transform:none;}
a:link {color:blue;
text-decoration:underline;}
a:visited {color:purle;
text-decoration:underline;}
a:active {color:yellow;
text-decoration:underline;}
a:hover {color:red;
text-decoration:underline;}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css