锚伪类的四种伪类

伪类:

与类选择器相似但是又有所不同

锚伪类:

<style>
			a:link
			{
				color: #2AABD2;
				font: "微软雅黑";
				font-size: 50px;
			}
		</style>
作用:给a标签设置没有访问过的样式
a:visited

a:visited
			{
				color: palevioletred;
				font: "微软雅黑";
				font-size: 30px;
			}
作用:给a标签设置访问过的样式
a:hover

a:hover
			{
				color: #000000;
				font: "微软雅黑";
				font-size: 30px;
			}
给a标签设置鼠标悬停时的样式
a:active

a:active
			{
				color:#3E8F3E;
				font: "微软雅黑";
				font-size: 30px;
			}
		</style>
作用:设置a标签激活时的样式


注意:在使用时一定遵循这样的顺序:

a:link  a:visited  a:hover  a:active

有些锚伪类可以作用a标签上也可以作用在其他标签上:

  1. a:link,a:visited 只能用于a标签
  2. :hover,其他标签也可以使用这个伪类
  3. a:active,其他标签也可以使用这个伪类


五彩导航:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			a{
				color: white;
				text-decoration: none;
				background-color: pink;
				width: 120px;
				height: 58px;
				display: inline-block;
				text-align: center;/*水平居中*/
				line-height: 58px;/*垂直居中*/
			}
			.one
			{
				background-color: paleturquoise;
			}
			.two
			{
				background-color: pink;
			}
			.three
			{
				background-color: plum;
				
			}
			.four
			{
				background-color: mediumpurple;
			}
			.one:hover
			{
				background-color: papayawhip;
			}
			.two:hover
			{
				background-color:palegreen;
			}
			.three:hover
			{
				background-color:hotpink;
			}
			.four:hover
			{
				background-color:deepskyblue;
			}
		</style>
	</head>
	<body style="text-align: center;">
		<a class="one" href="#">导航1</a>
		<a class="two" href="#">导航2</a>
		<a class="three" href="#">导航3</a>
		<a class="four" href="#">导航4</a>
	</body>
</html>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值