CSS学习<5>

一、CSS链接

CSS能够以不同的方式给链接设置样式。

链接的特殊性在于能根据他们所处的状态来设置样式。

链接的四种状态:

1.a:link        --普通的、未被访问的链接。

2.a:visited   --用户已访问的链接。

3.a:hover    --鼠标指针位于链接的上方。

4.a:active    --链接被点击的时刻。

在源码中,请保证此顺序定义,避免定义无效。

1.1、设置链接的文本颜色

采用内部样式表 

<!DOCTYPE html>

<html>

<head>

<style>

a:link {color : red;}

a:visited {color : green;}

a:hover {color : blue;}

a:active {color : black;}

</style>

</head>

</body>

<p><a href="http://www.baidu.com">此处链接</a></p>

</body>

</html>

1.2、文本修饰

文本修饰属性:text-decoration用于去掉链接中的下划线。

如:

<style>

a:link {text-decoration : none;}

a:visited {text-decoration : none;}

a:hover {text-decoration : underline;}

a:active {text-decoration : underline;}

</style>

1.3、链接背景色

链接背景色属性:background-color 规定链接的背景色。使用类似于链接文本颜色。

其他的很多属性,照样适用于链接中。且属性的使用方法大同小异。

二、CSS列表

2.1、列表类型

列表类型的属性为:list-style-type.属性对应的值为:disc(实心圆点)、circle(空心圆点)、square(实心方块)、none。

2.2、列表项图像

列表项图像的属性:list-style-image 其属性值为url(地址)。

如:

ul {list-style-image : url(/i/eg_arrow.gif);}

2.3、列表标志位置

列表标志位置的属性:list-style-position 其属性值为:inside、outside。



你可能感兴趣的:(CSS链接,CSS列表)