css之伪类选择器

伪类选择器

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>

<style type="text/css">
  /*h1:hover{*/
  /*  color: red;*/
  /*}*/

  .myclass:hover{
    color: blue;
  }
  /*设置静止状态*/
  a:link{
    color: yellow;
  }
/*  设置鼠标悬浮状态*/
  a:hover{
    color: red;
  }
/* 设置鼠标触发状态 */
  a:active{
    color: blue;
  }
/* 设置鼠标完成状态 */
  a:visited{
    color: green;
  }
</style>
<body>
<!--
伪类选择器:
向某些选择器添加特殊效果

一般伪类选择器上都是用在超链接上
-->
<a href="https://www.baidu.com">aaaa</a>
<h1 class="myclass">我是标题</h1>

</body>
</html>
posted @ 2023-03-01 22:28  King-DA  阅读(46)  评论(0)    收藏  举报