CSS链接伪类:超链接的状态

时间:2023-03-10 03:38:42
CSS链接伪类:超链接的状态

一、状态:

a:link{属性:值;}       链接默认状态
a:visited{属性:值;} 链接访问之后的状态
a:hover{属性:值;} 鼠标放到链接上显示的状态
a:active{属性:值;} 链接激活的状态
:focus{属性:值;} 获取焦点

二、注意点:

  • a:link{属性:值;}  a{属性:值}效果是一样的。
  • 样式的书写最好按照一定顺序
<style type="text/css">

        }
a:link{
color: red;
text-decoration: none;
}
a:visited{
color: green;
text-decoration: line-through;
}
a:hover{
color: yellow;
text-decoration: underline;
}
a:active{
color: blue;
text-decoration: overline;
} </style>
</head>
<body>
<a href="#">链接伪类</a>
</body>